[ 
https://issues.apache.org/jira/browse/ARROW-14267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henrikh Kantuni updated ARROW-14267:
------------------------------------
    Summary: Cannot convert DataFrame with geometry cells to Table  (was: 
Cannot convert DataFrame with geometry `numpy.dtype` cells to Table)

> Cannot convert DataFrame with geometry cells to Table
> -----------------------------------------------------
>
>                 Key: ARROW-14267
>                 URL: https://issues.apache.org/jira/browse/ARROW-14267
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 5.0.0
>            Reporter: Henrikh Kantuni
>            Priority: Minor
>              Labels: pyarrow
>
> Example: 
> {code:java}
> import geopandas as gpd
> import pandas as pd
> import pyarrow as pa
> path = gpd.datasets.get_path("naturalearth_lowres")
> data = gpd.read_file(path)
> df = pd.DataFrame(data)
> table = pa.Table.from_pandas(df)
> print(table)
> {code}
> Throws the following error:
> {code:java}
> Traceback (most recent call last):
>  File "/Users/Henrikh/Desktop/tmp.py", line 8, in <module>
>  table = pa.Table.from_pandas(df)
>  File "pyarrow/table.pxi", line 1553, in pyarrow.lib.Table.from_pandas
>  File "/usr/local/lib/python3.9/site-packages/pyarrow/pandas_compat.py", line 
> 594, in dataframe_to_arrays
>  arrays = [convert_column(c, f)
>  File "/usr/local/lib/python3.9/site-packages/pyarrow/pandas_compat.py", line 
> 594, in <listcomp>
>  arrays = [convert_column(c, f)
>  File "/usr/local/lib/python3.9/site-packages/pyarrow/pandas_compat.py", line 
> 581, in convert_column
>  raise e
>  File "/usr/local/lib/python3.9/site-packages/pyarrow/pandas_compat.py", line 
> 575, in convert_column
>  result = pa.array(col, type=type_, from_pandas=True, safe=safe)
>  File "pyarrow/array.pxi", line 302, in pyarrow.lib.array
>  File "pyarrow/array.pxi", line 79, in pyarrow.lib._ndarray_to_array
>  File "pyarrow/array.pxi", line 67, in pyarrow.lib._ndarray_to_type
>  File "pyarrow/error.pxi", line 120, in pyarrow.lib.check_status
> pyarrow.lib.ArrowTypeError: ('Did not pass numpy.dtype object', 'Conversion 
> failed for column geometry with type geometry'){code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to