Skip to content

Variance of nullable Int64 ignores ddof argument #29128

Closed
@VictorDavis

Description

@VictorDavis

Variance calculation Series.var() is ignoring the ddof argument for nullable integer type Int64. Behavior should match that of float type.

>>> pd.__version__
'0.25.1'
>>> np.__version__
'1.17.2'
>>> s1 = pd.Series(data=[1,2,3,4,5,6,np.nan,np.nan])
>>> series.var(ddof=0)
3.5
>>> s1 = pd.Series(data=[1,2,3,4,5,6,np.nan,np.nan])
>>> s1.var(ddof=0)
2.9166666666666665
>>> s1.var(ddof=1)
3.5
>>> s2 = pd.Series(data=[1,2,3,4,5,6,np.nan,np.nan], dtype="Int64")
>>> s2.var(ddof=0)
3.5
>>> s2.var(ddof=1)
3.5 

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugExtensionArrayExtending pandas with custom dtypes or arrays.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions