Open
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
Code Sample, a copy-pastable example
On pandas 1.0.3:
df = pd.DataFrame([7,8,9,pd.NA])
print(df.dtypes)
# 0 object
# dtype: object
Problem description
Creating a DataFrame with mixed int and pd.NA defaults to object
instead of Int64
According to @simonjayhawkins in #32931
since pd.NA is experimental, changing the constructor to default to the best possible dtypes using dtypes supporting pd.NA seems reasonable.
Expected Output
pd.DataFrame([7,8,9,pd.NA]).dtypes
# 0 Int64
# dtype: object
Metadata
Metadata
Assignees
Labels
Series/DataFrame/Index/pd.array ConstructorsUnexpected or buggy dtype conversionsExtending pandas with custom dtypes or arrays.Related to pd.NA and nullable extension arraysRequires discussion from core team before further actionIssues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint