How to use pd.Grouper with an offset?

Viewed 370

I have a dataframe df indexed by DateTime, spanning multiple years. Now, I wish to group the data where each group will have 16th as starting date, and 15th of next month as ending date. How do I do this?

I tried df2.groupby(pd.Grouper(freq="MS", offset="16D"), but the offset doesn't seem to have any effect and it still gives me groups starting at the 1st of each month.

0 Answers
Related