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

Type conversion failure on numpy 0.1.20 #27330

Closed
asfimport opened this issue Jan 31, 2021 · 1 comment
Closed

Type conversion failure on numpy 0.1.20 #27330

asfimport opened this issue Jan 31, 2021 · 1 comment

Comments

@asfimport
Copy link

asfimport commented Jan 31, 2021

While I have not dug deep enough in the Arrow codebase, it seems to me that this is caused by the new numpy release: https://github.com/numpy/numpy/releases 

The issue below in fact is not observed when using numpy 0.19.*

 

 

 

>>> pandas.__version__, pa.__version__, numpy.__version__
('1.2.1', '2.0.0', '1.20.0')
>>> df = pandas.DataFrame({'a': numpy.random.randn(10), 'b': numpy.random.randn(7).tolist() + [None, pandas.NA, numpy.nan], 'c': list(range(9)) + [numpy.nan]})
>>> pa.Table.from_pandas(df)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    pa.Table.from_pandas(df)
  File "pyarrow/table.pxi", line 1394, in pyarrow.lib.Table.from_pandas
  File "/Users/carlomazzafero/.virtualenvs/arr/lib/python3.7/site-packages/pyarrow/pandas_compat.py", line 588, in dataframe_to_arrays
    for c, f in zip(columns_to_convert, convert_fields)]
  File "/Users/carlomazzafero/.virtualenvs/arr/lib/python3.7/site-packages/pyarrow/pandas_compat.py", line 588, in <listcomp>
    for c, f in zip(columns_to_convert, convert_fields)]
  File "/Users/carlomazzafero/.virtualenvs/arr/lib/python3.7/site-packages/pyarrow/pandas_compat.py", line 574, in convert_column
    raise e
  File "/Users/carlomazzafero/.virtualenvs/arr/lib/python3.7/site-packages/pyarrow/pandas_compat.py", line 568, in convert_column
    result = pa.array(col, type=type_, from_pandas=True, safe=safe)
  File "pyarrow/array.pxi", line 292, 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 107, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: ('Did not pass numpy.dtype object', 'Conversion failed for column a with type float64')

Environment: Python 3.7.4
Mac OS

Reporter: Carlo Mazzaferro
Assignee: Uwe Korn / @xhochy

Related issues:

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

@asfimport
Copy link
Author

Uwe Korn / @xhochy:
This is known issue with wheels older versions, see also the linked issue and numpy/numpy#17913. Please update your pyarrow version if you want to use the latest NumPy release.

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

2 participants