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

langmore opened this issue Oct 2, 2013 · 1 comment


None yet
3 participants
Copy link

commented Oct 2, 2013

>>>import pandas as pd
>>> pd.__version__

>>> import numpy as np
>>> np.version.version

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

>>> sdf.groupby('a').mean() 
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.


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.