Python Forum

Full Version: how to: explicitly select the grouping columns after groupby
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
backtestdf_complete.groupby(['b_index', 'sample_dur']).apply(day_test)
That bit of code is throwing me:

Output:
/Volumes/Python/findparams.py:123: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning. backtestdf_complete.groupby(['b_index', 'sample_dur']).apply(day_test, include_groups=True)
So I need my grouping columns to be included in the operation. So per the warning I'm guessing I can "explicitly select the grouping columns after groupby" - but how do I do that? I cannot find an example... thank you.