-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Table.to_pandas
fails to convert index dtype
with a custom type mapper
#34283
Comments
Yes, I think that the dtype of an index is never converted according to the A single array gets converted to pandas series in arrow/python/pyarrow/array.pxi Line 1649 in 958f635
This would be a good add on. What would be needed is to use pandas api to reset the series index with As for the Table, it gets converted with the use of pandas BlockManager and I am not sure how the desired dtype could be passed to the BlockManager axes in that case: arrow/python/pyarrow/table.pxi Lines 4001 to 4008 in 7828165
arrow/python/pyarrow/pandas_compat.py Lines 797 to 823 in 45918a9
|
…4445) ### Rationale for this change ### What changes are included in this PR? Only respects types_mapper for indexes as well ### Are these changes tested? Yes ### Are there any user-facing changes? Technically this breaks the API in a way that we would now respect the types_mapper for the index. - [x] closes #34283 cc @ jorisvandenbossche Authored-by: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Issue resolved by pull request 34445 |
Describe the bug, including details regarding any error messages, version, and platform.
When providing a custom type mapper to
pyarrow.Table.to_pandas
, column dtypes are converted, but not index dtypes.Example:
This prints:
Column
s1
was mapped tostring[pyarrow]
dtype, however, the index dtype remainedobject
. I'd expect the type mapper being used to convert the indexdtype
as well.Platform: macOS
Pyarrow version: 11.0.0
Build: py310h89f3c6b_2_cpu
Channel: conda-forge
Component(s)
Python
The text was updated successfully, but these errors were encountered: