We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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 numpy as np import pandas as pd import datetime df = pd.DataFrame({'A': [1, 1, 1, 2, 2, 2], 'B': [1, 2, 3, 4, 5, 6]}) grouped = df.groupby('A') n = 20 data = np.random.randn(n, 4) dt_df = pd.DataFrame(data, columns=['A', 'B', 'C', 'D']) dt_df['key'] = [datetime.datetime(2013, 1, 1), datetime.datetime(2013, 1, 2), pd.NaT, datetime.datetime(2013, 1, 4), datetime.datetime(2013, 1, 5)] * 4 # OK, index is named as 'key' grouped = dt_df.groupby('key') grouped.size() # key #2013-01-01 4 #2013-01-02 4 #2013-01-04 4 #2013-01-05 4 # dtype: int64 # NG (no index name) grouper = dt_df.groupby(pd.TimeGrouper(key='key', freq='D')) grouper.size() #2013-01-01 4 #2013-01-02 4 #2013-01-03 0 #2013-01-04 4 #2013-01-05 4 # dtype: int64 # other agg methods looks ok grouper.count() # A B C D # key #2013-01-01 4 4 4 4 #2013-01-02 4 4 4 4 #2013-01-03 0 0 0 0 #2013-01-04 4 4 4 4 #2013-01-05 4 4 4 4
ref: #9862
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
ref: #9862
The text was updated successfully, but these errors were encountered: