BUG: Series dtype not as specified when values are missing #46782
Labels
Constructors
Series/DataFrame/Index/pd.array Constructors
Dtype Conversions
Unexpected or buggy dtype conversions
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
pd.Series() does not respect the specified dtype and breaks compatibility with previous (1.3.5) version.
Expected Behavior
Should be backward compatible with 1.3.5: the result should have the dtype specified by the caller.
This issue seems (I'm not sure) related to #46672
The problem is that missing values (unspecified in the constructor) are initialized to NaNs, and thus floats, whereas in Pandas 1.3.5 they were initialized with zeroes.
Installed Versions
The text was updated successfully, but these errors were encountered: