- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 19.2k
Open
Labels
Arrowpyarrow functionalitypyarrow functionalityBugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvespyarrow dtype retentionop with pyarrow dtype -> expect pyarrow resultop with pyarrow dtype -> expect pyarrow result
Description
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
import datetime
import pandas as pd
import pyarrow as pa
df = pd.DataFrame([[42]], columns=["col"])
df["int16"] = pa.array([16], type=pa.int16())
df["date"] = pa.array([datetime.date(2024, 1, 1)], type=pa.date32())
df["string"] = pa.array(["foo"], pa.string())Issue Description
>>> 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
Metadata
Metadata
Assignees
Labels
Arrowpyarrow functionalitypyarrow functionalityBugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvespyarrow dtype retentionop with pyarrow dtype -> expect pyarrow resultop with pyarrow dtype -> expect pyarrow result