Skip to content

BUG: DataFrame[Int64].mean().dtype is object, should be Float64 #42895

@jbrockmendel

Description

@jbrockmendel

This breaks the last corner case I want to test for #33036.

arr = np.random.randn(4, 3).astype("int64") df = pd.DataFrame(arr).astype("Int64") df.iloc[:, 1] = pd.NA # <-- incorrectly casts to object, lets cast back and ignore that for now df = df.astype("Int64") res = df.mean() >>> res 0 0.0 1 <NA> 2 -0.25 dtype: object 

Trivial to fix with 2D EAs, not sure how/if to fix it without.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions