You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jorisvandenbossche (via GitHub)" <gi...@apache.org> on 2023/06/28 09:24:28 UTC
[GitHub] [arrow] jorisvandenbossche commented on pull request #36314: GH-36096: [Python] Call __from_arrow__ in Array.to_pandas
jorisvandenbossche commented on PR #36314:
URL: https://github.com/apache/arrow/pull/36314#issuecomment-1611070229
Hmm, so the failing tests point out an issue with this approach: we have some keywords to control the conversion, notably `timestamp_as_object` in this case.
And if the user passes this, and we just call `pandas_dtype.__from_arrow__` nonetheless, this keyword gets ignored.
But, we also already have this problem, as this already happens for the ChunkedArray conversion:
```
In [8]: from datetime import datetime
...: import pyarrow as pa
...:
...: arr = pa.array([datetime(2001, 1, 1)], pa.timestamp("s", tz="America/New_York"))
...: table = pa.table({'a': arr})
In [9]: arr.to_pandas(timestamp_as_object=True)
Out[9]:
0 2000-12-31 19:00:00-05:00
dtype: object
In [10]: table["a"].to_pandas(timestamp_as_object=True)
Out[10]:
0 2000-12-31 19:00:00-05:00
Name: a, dtype: datetime64[ns, America/New_York]
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org