stephen-a-stc opened a new issue, #45296:
URL: https://github.com/apache/arrow/issues/45296

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   ## Summary
   
   Using the pyarrow table method `to_pandas()` results in an exception if 
`pandas.set_option('future.infer_string', True)` has been set.  This seems 
related to handling of string data.  
   
   ## Environment
   
   Environments: Windows 11, and Linux (docker image "python")
   Python versions tested: 3.10, 3.11, 3.12
   
   Python packages: `pyarrow==19.0.0`, `pandas==2.2.3`
   
   
   ## Example
   ```python
   import pandas
   import pyarrow
   
   print("Create pyarrow table")
   pat=pyarrow.Table.from_pydict({"foo":["bar","baz"]})
   print(pat)
   
   print("convert to pandas")
   df1 = pat.to_pandas()
   print(df1)
   
   print("Set 'future.infer_string' to True")
   pandas.set_option('future.infer_string', True)
   
   print("exception during convert to pandas")
   df2 = pat.to_pandas()
   print(df2)
   ```
   
   ## Example's output
   ```plaintext
   Create pyarrow table
   pyarrow.Table
   foo: string
   ----
   foo: [["bar","baz"]]
   convert to pandas
      foo
   0  bar
   1  baz
   Set 'future.infer_string' to True
   convert to pandas again
   Traceback (most recent call last):
     File "C:\temp\foo.py", line 16, in <module>
       df2 = pat.to_pandas()
     File "pyarrow\\array.pxi", line 889, in 
pyarrow.lib._PandasConvertible.to_pandas
     File "pyarrow\\table.pxi", line 5132, in pyarrow.lib.Table._to_pandas
     File "C:\penv\brd_test\lib\site-packages\pyarrow\pandas_compat.py", line 
800, in table_to_dataframe
       ext_columns_dtypes = _get_extension_dtypes(
     File "C:\penv\brd_test\lib\site-packages\pyarrow\pandas_compat.py", line 
925, in _get_extension_dtypes
       ext_columns[field.name] = _pandas_api.pd.StringDtype(na_value=np.nan)
   TypeError: StringDtype.__init__() got an unexpected keyword argument 
'na_value'
   ```
   
   
   ### 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: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to