You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> df.dtypes
col int64
int16 int16
date datetime64[s]
string object
dtype: object
I am surprised that the pyarrow type is not maintained during assignment
Expected Behavior
>>> df.dtypes
col int64
int16 int16[pyarrow]
date date32[pyarrow]
string string[pyarrow]
dtype: object
Installed Versions
on main
The text was updated successfully, but these errors were encountered:
WillAyd
added
Bug
Needs Triage
Issue that has not been reviewed by a pandas team member
Indexing
Related to indexing on series/frames, not to indexes themselves
Arrow
pyarrow functionality
and removed
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Jan 21, 2024
WillAyd
changed the title
BUG: Assignment of pyarrow string array yields unexpected dtypes
BUG: Assignment of pyarrow arrays yields unexpected dtypes
Jan 21, 2024
Hi @WillAyd: I propose in PR #58601 that during a column assignment in a DataFrame, sanitize_array is called with a dtype equals to ArrowDtype(value.type) if the column value is a pa.lib.Array (else the standard behaviour is kept)
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
Issue Description
I am surprised that the pyarrow type is not maintained during assignment
Expected Behavior
Installed Versions
on main
The text was updated successfully, but these errors were encountered: