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
http://stackoverflow.com/questions/25050015/resampling-over-dates-in-both-levels-of-a-multiindex-pandas-dataframe/25050074#25050074
from datetime import date d0 = date.today() - timedelta(days=14) dates = pd.date_range(d0, date.today()) date_index = pd.MultiIndex.from_product([dates, dates], names=['cohort_date', 'event_date']) df = pd.DataFrame(np.random.randint(0, 100, 225), index=date_index)
Works
df.reset_index().groupby([pd.Grouper(key='cohort_date',freq='W'),pd.Grouper(key='event_date',freq='W')]).sum()
This should be equivalent, but raises
df.groupby([pd.Grouper(level='cohort_date',freq='W'),pd.Grouper(level='event_date',freq='W')]).sum()
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
http://stackoverflow.com/questions/25050015/resampling-over-dates-in-both-levels-of-a-multiindex-pandas-dataframe/25050074#25050074
Works
This should be equivalent, but raises
The text was updated successfully, but these errors were encountered: