jorisvandenbossche commented on code in PR #14531:
URL: https://github.com/apache/arrow/pull/14531#discussion_r1017731162
##########
python/pyarrow/tests/test_pandas.py:
##########
@@ -4498,3 +4498,18 @@ def test_does_not_mutate_timedelta_dtype():
t.to_pandas()
assert np.dtype(np.timedelta64) == expected
+
+
+def test_read_feather_does_not_mutate_timedelta():
+ # ARROW-17893: dataframe with timedelta and a list of dictionary
+ # also with timedelta produces wrong result with to_pandas
+
+ from datetime import timedelta
+ timedelta_1 = [{"timedelta_1": timedelta(seconds=12, microseconds=1)}]
+ timedelta_2 = [timedelta(hours=3, minutes=40, seconds=23)]
+ data = {"timedelta_1": timedelta_1, "timedelta_2": timedelta_2, }
+
+ table = pa.Table.from_pydict(data)
Review Comment:
```suggestion
table = pa.table({"timedelta_1": timedelta_1, "timedelta_2":
timedelta_2})
```
##########
python/pyarrow/tests/test_pandas.py:
##########
@@ -4498,3 +4498,18 @@ def test_does_not_mutate_timedelta_dtype():
t.to_pandas()
assert np.dtype(np.timedelta64) == expected
+
+
+def test_read_feather_does_not_mutate_timedelta():
Review Comment:
```suggestion
def test_does_not_mutate_timedelta_nested():
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]