You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2019/09/06 19:19:00 UTC

[jira] [Assigned] (ARROW-5161) [Python] Cannot convert struct type from Pandas object column

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

Wes McKinney reassigned ARROW-5161:
-----------------------------------

    Assignee: Wes McKinney

> [Python] Cannot convert struct type from Pandas object column
> -------------------------------------------------------------
>
>                 Key: ARROW-5161
>                 URL: https://issues.apache.org/jira/browse/ARROW-5161
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.13.0
>            Reporter: Antoine Pitrou
>            Assignee: Wes McKinney
>            Priority: Major
>             Fix For: 0.15.0
>
>
> As reported on [https://github.com/apache/arrow/issues/4045]. Interestingly, the datatype is inferred correctly.
> {code:python}
> >>> df = pd.DataFrame({'col': [{'ints': 5, 'strs': 'foo'}, {'ints': 6, 'strs': 'bar'}]})                                                                             
> >>> df                                                                                                                                                               
>                           col
> 0  {'ints': 5, 'strs': 'foo'}
> 1  {'ints': 6, 'strs': 'bar'}
> >>> pa.Table.from_pandas(df)                                                                                                                                         
> Traceback (most recent call last):
>   File "<ipython-input-16-6eac5d0eec08>", line 1, in <module>
>     pa.Table.from_pandas(df)
>   File "pyarrow/table.pxi", line 1139, in pyarrow.lib.Table.from_pandas
>     names, arrays, metadata = dataframe_to_arrays(
>   File "/home/antoine/arrow/dev/python/pyarrow/pandas_compat.py", line 480, in dataframe_to_arrays
>     types)
>   File "/home/antoine/arrow/dev/python/pyarrow/pandas_compat.py", line 209, in construct_metadata
>     field_name=sanitized_name)
>   File "/home/antoine/arrow/dev/python/pyarrow/pandas_compat.py", line 151, in get_column_metadata
>     logical_type = get_logical_type(arrow_type)
>   File "/home/antoine/arrow/dev/python/pyarrow/pandas_compat.py", line 79, in get_logical_type
>     raise NotImplementedError(str(arrow_type))
> NotImplementedError: struct<ints: int64, strs: string>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)