-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
Arrowpyarrow functionalitypyarrow functionalityBugNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsStringsString extension data type and string dataString extension data type and string datagood first issue
Description
ser = pd.Series(range(5), dtype="string[python]")
ser2 = ser.astype("string[pyarrow]")
>>> ser[:2] = ser2[:2]
File "pandas/core/arrays/string_.py", line 428, in __setitem__
if len(value) and not lib.is_string_array(value, skipna=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Argument 'values' has incorrect type (expected numpy.ndarray, got ArrowStringArray)
lib.is_string_array check in the traceback is preceded by
if not is_array_like(value):
value = np.asarray(value, dtype=object)
if len(value) and not lib.is_string_array(value, skipna=True):
The is_array_like here is wrong. In this case we just need to convert to ndarray unconditionally.
Metadata
Metadata
Assignees
Labels
Arrowpyarrow functionalitypyarrow functionalityBugNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsStringsString extension data type and string dataString extension data type and string datagood first issue