thisisnic commented on issue #28474:
URL: https://github.com/apache/arrow/issues/28474#issuecomment-6711475875
@AlenkaF can we close this? AI analysis says:
_________________________________________________
:robot: :
Still reproduces with pyarrow 26.0.1 and pandas 3.1.1, though the trigger
has moved. Reading the attached `period.parquet` in a fresh process gives
`int64` before importing pandas, after importing pandas, and after
`to_pandas()`. It only switches to `ArrowPeriodType` once a period column has
been converted *to* Arrow (e.g. `pa.table(pd.DataFrame({"a":
pd.period_range("2012", freq="Y", periods=1)}))`), because that is now the only
code path that imports `pandas.core.arrays.arrow.extension_types`, which is
where the registration happens.
pyarrow's behaviour is consistent: it restores a registered extension type
and leaves an unregistered one as its storage type. `to_pandas()` returns
`period[M]` at every stage regardless, since that uses the pandas schema
metadata. The fix would be for pandas to register its extension types on
import, which is tracked in pandas-dev/pandas#41432 (still open). Nothing to
change on the Arrow side.
--
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]