MCPcopy Create free account
hub / github.com/apache/arrow / test_does_not_mutate_timedelta_nested

Function test_does_not_mutate_timedelta_nested

python/pyarrow/tests/test_pandas.py:5026–5036  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5024
5025
5026def test_does_not_mutate_timedelta_nested():
5027 # ARROW-17893: dataframe with timedelta and a list of dictionary
5028 # also with timedelta produces wrong result with to_pandas
5029
5030 from datetime import timedelta
5031 timedelta_1 = [{"timedelta_1": timedelta(seconds=12, microseconds=1)}]
5032 timedelta_2 = [timedelta(hours=3, minutes=40, seconds=23)]
5033 table = pa.table({"timedelta_1": timedelta_1, "timedelta_2": timedelta_2})
5034 df = table.to_pandas()
5035
5036 assert df["timedelta_2"][0].to_pytimedelta() == timedelta_2[0]
5037
5038
5039def test_roundtrip_nested_map_table_with_pydicts():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected