alexeykudinkin opened a new issue, #47023:
URL: https://github.com/apache/arrow/issues/47023

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Currently, `TypeInferrer` fails with the following exception when you're 
trying to use keys with non-string/binary types:
   
   ```
       arrow_table = pa.Table.from_pandas(self._table, preserve_index=False)
     File "pyarrow/table.pxi", line 4751, in pyarrow.lib.Table.from_pandas
     File 
"/opt/anaconda3/envs/rayturbo/lib/python3.9/site-packages/pyarrow/pandas_compat.py",
 line 639, in dataframe_to_arrays
       arrays = [convert_column(c, f)
     File 
"/opt/anaconda3/envs/rayturbo/lib/python3.9/site-packages/pyarrow/pandas_compat.py",
 line 639, in <listcomp>
       arrays = [convert_column(c, f)
     File 
"/opt/anaconda3/envs/rayturbo/lib/python3.9/site-packages/pyarrow/pandas_compat.py",
 line 626, in convert_column
       raise e
     File 
"/opt/anaconda3/envs/rayturbo/lib/python3.9/site-packages/pyarrow/pandas_compat.py",
 line 620, in convert_column
       result = pa.array(col, type=type_, from_pandas=True, safe=safe)
     File "pyarrow/array.pxi", line 362, in pyarrow.lib.array
     File "pyarrow/array.pxi", line 87, in pyarrow.lib._ndarray_to_array
     File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
   pyarrow.lib.ArrowTypeError: ("Expected dict key of type str or bytes, got 
'int'", 'Conversion failed for column value_counter(value) with type object')
   ```
   
   However Arrow supports integer type as key-types in the maps perfectly fine:
   
   ```
   # Fails
   arr = pa.array({0: 1})
   
   # Works perfectly fine
   arr = pa.array({0: 1}, type=pa.map_(pa.int64(), pa.int64()))
   ```
   
   ### Component(s)
   
   Format


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