We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
>>>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.
a == 0
a == 1
The text was updated successfully, but these errors were encountered:
Are there any planes to fix this any time soon?
Sorry, something went wrong.
@OmerJog this works with a DataFrame with sparse values
In [90]: df = pd.DataFrame({'a': [0, 1, 0, 0], 'b': [0, 1, 0, 0]}) In [91]: df.apply(pd.SparseArray).groupby('a').mean() Out[91]: b a 0 0 1 1
Successfully merging a pull request may close this issue.
I'm not surpised that the mean for group
a == 0
was not returned. It is surprising that the result for groupa == 1
was incorrect.The text was updated successfully, but these errors were encountered: