Skip to content

Variance of nullable Int64 ignores ddof argument #29128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VictorDavis opened this issue Oct 21, 2019 · 1 comment · Fixed by #29353
Closed

Variance of nullable Int64 ignores ddof argument #29128

VictorDavis opened this issue Oct 21, 2019 · 1 comment · Fixed by #29353
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Milestone

Comments

@VictorDavis
Copy link

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 
@jorisvandenbossche
Copy link
Member

@VictorDavis thanks for the report!
From a quick look, it seems the argument is not passed through, here:

result = op(data, axis=0, skipna=skipna, mask=mask)

@jorisvandenbossche jorisvandenbossche added Bug ExtensionArray Extending pandas with custom dtypes or arrays. labels Oct 21, 2019
@jorisvandenbossche jorisvandenbossche added this to the Contributions Welcome milestone Oct 21, 2019
@jreback jreback modified the milestones: Contributions Welcome, 1.0 Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants