j-bennet opened a new issue, #34283:
URL: https://github.com/apache/arrow/issues/34283

   ### 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:
   
   ```python
   import pyarrow as pa
   import pandas as pd
   
   df = pd.DataFrame({"s1": ["a", "c", "b"], "i1": [1, 2, 3], "s2": ["d", "e", 
"f"]}).set_index('s2')
   tbl = pa.Table.from_pandas(df)
   mapper = {pa.string(): pd.StringDtype("pyarrow")}.get
   df2 = tbl.to_pandas(types_mapper=mapper)
   print(f"{df2.dtypes}")
   print(f"{df2.index.dtype = }")
   ```
   
   This prints:
   
   ```
   s1    string[pyarrow]
   i1              int64
   dtype: object
   df2.index.dtype = dtype('O')
   ```
   
   Column `s1` was mapped to `string[pyarrow]` dtype, however, the index dtype 
remained `object`. I'd expect the type mapper being used to convert the index 
`dtype` as well.
   
   Platform: macOS
   Pyarrow version: 11.0.0
   Build: py310h89f3c6b_2_cpu
   Channel: conda-forge
   
   ### Component(s)
   
   Python


-- 
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]

Reply via email to