Skip to content

BUG: pd.array raising for large_string/large_binary with NumPy array #52590

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

Closed
3 tasks done
phofl opened this issue Apr 11, 2023 · 0 comments · Fixed by #52591
Closed
3 tasks done

BUG: pd.array raising for large_string/large_binary with NumPy array #52590

phofl opened this issue Apr 11, 2023 · 0 comments · Fixed by #52591
Labels
Arrow pyarrow functionality Bug

Comments

@phofl
Copy link
Member

phofl commented Apr 11, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

arr = np.array(["a", "b"])
pd.array(arr, dtype=pd.ArrowDtype(pa.large_string()))
arr = np.array([b"a", b"b"])
pd.array(arr, dtype=pd.ArrowDtype(pa.large_binary()))
Traceback (most recent call last):
  File "/Users/patrick/Library/Application Support/JetBrains/PyCharm2023.1/scratches/scratch.py", line 530, in <module>
    pd.array(arr, dtype=pd.ArrowDtype(pa.large_string()))
  File "/Users/patrick/PycharmProjects/pandas/pandas/core/construction.py", line 327, in array
    return cls._from_sequence(data, dtype=dtype, copy=copy)
  File "/Users/patrick/PycharmProjects/pandas/pandas/core/arrays/arrow/array.py", line 250, in _from_sequence
    scalars = pa.array(scalars, type=pa_dtype, from_pandas=True)
  File "pyarrow/array.pxi", line 316, in pyarrow.lib.array
  File "pyarrow/array.pxi", line 83, in pyarrow.lib._ndarray_to_array
  File "pyarrow/error.pxi", line 121, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: NumPyConverter doesn't implement <large_string> conversion. 

Issue Description

This raises since NumPy does not implement the converter. I think we should work around this.

Expected Behavior

Returns an ArrowExtensionArray

Installed Versions

main

@phofl phofl added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 11, 2023
@phofl phofl added Arrow pyarrow functionality and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant