Skip to content
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

Sparse data frame doesn't groupby.mean() correctly #5078

Open
langmore opened this issue Oct 2, 2013 · 1 comment

Comments

Projects
None yet
3 participants
@langmore
Copy link

commented Oct 2, 2013

>>>import pandas as pd
>>> pd.__version__
 '0.12.0-660-gec77315'

>>> import numpy as np
>>> np.version.version
'1.7.1'

>>> df = pd.DataFrame({'a': [0, 1, 0, 0], 'b': [0, 1, 0, 0]})
>>> sdf = df.to_sparse(fill_value=0)
>>> df.groupby('a').mean() 
    b
a   
0  0
1  1

>>> sdf.groupby('a').mean() 
    b
a   
1  0

I'm not surpised that the mean for group a == 0 was not returned. It is surprising that the result for group a == 1 was incorrect.

@OmerJog

This comment has been minimized.

Copy link

commented Nov 28, 2018

Are there any planes to fix this any time soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.