-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: implement SeriesGroupBy.corrwith #32293
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
Comments
Turns out So this behavior can be achieved by: >>> import pandas as pd
>>> pd.__version__
'1.1.0.dev0+1712.g1cad9e52e'
>>> df = pd.DataFrame({'key': list('aaabbb'), 'value': [1, 2, 3, 3, 2, 1]})
>>> df.groupby('key')['value'].corr(pd.Series([1, 2, 3, 1, 2, 3]))
key
a 1.0
b -1.0
Name: value, dtype: float64 A few thoughts:
@simonjayhawkins what do you think? |
see also #11260 cc @pandas-dev/pandas-core |
|
Sample data
Issue
Problem description
As shown above, DataFrameGroupBy.corrwith has no issues and works as expected. However, the corresponding SeriesGroupBy.corrwith is not implemented and reports error.
Expected Output
The text was updated successfully, but these errors were encountered: