Dataframe column filled with .sum() of int-series has dtype not int64, but object #20754
Labels
Dtype Conversions
Unexpected or buggy dtype conversions
Duplicate Report
Duplicate issue or pull request
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
MnWE
This yields
Problem description
Assigning the sum of a Series of (vanilla Python)
int
s to a DataFrame leads to not specific enough type inference on the frame: it keeps the object type. Vanillafloat
s work fine, as the second example demonstrates.This is an issue for some testing I'm doing, where I want to ensure a column of these sums contains only numeric data, and specifically integers.
Might be related to #20635.
Expected Output
Expected output:
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: