Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
1.0.0
-
None
-
None
Description
Hello !
It looks like it is possible to map arrow types to pandas types using the `types_mapper` argument in `to_pandas`. However it seems to work only for `pa.Table.to_pandas` and not `pa.array.to_pandas`.
Example to reproduce:
import pyarrow as pa import pandas as pd def types_mapper(dtype): print("Looking at dtype") if dtype == pa.int64(): print("Changing dtype") return pd.Int32Dtype() arr = pa.array([1,2,3], pa.int64()) print(pa.Table.from_arrays([arr], names=["col"]).to_pandas(types_mapper=types_mapper).col.dtype) # Prints: # Looking at dtype # Changing dtype # Int32 print(arr.to_pandas(types_mapper=types_mapper).dtype) # Prints: # int64
Attachments
Issue Links
- duplicates
-
ARROW-9664 [Python] Array/ChunkedArray.to_pandas do not support types_mapper keyword
- Resolved