Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Cannot convert struct type from Pandas object column #21640

Closed
asfimport opened this issue Apr 11, 2019 · 3 comments
Closed

[Python] Cannot convert struct type from Pandas object column #21640

asfimport opened this issue Apr 11, 2019 · 3 comments

Comments

@asfimport
Copy link

As reported on #4045. Interestingly, the datatype is inferred correctly.

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

Reporter: Antoine Pitrou / @pitrou

Note: This issue was originally created as ARROW-5161. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Added to 0.15.0.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
This is working in master. I'll add a unit test

@asfimport
Copy link
Author

Wes McKinney / @wesm:
This was fixed and tested in ARROW-5286

@asfimport asfimport added this to the 0.15.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant