I have the following DataFrame:
df = pd.DataFrame({
'Branch' : 'A A A A A B'.split(),
'Buyer': 'Carl Mark Carl Joe Joe Carl'.split(),
'Quantity': [1,3,5,8,9,3],
'Date' : [
DT.datetime(2013,1,1,13,0),
DT.datetime(2013,1,1,13,5),
DT.datetime(2013,10,1,20,0),
DT.datetime(2013,10,2,10,0),
DT.datetime(2013,12,2,12,0),
DT.datetime(2013,12,2,14,0),
]})
from pandas.tseries.resample import TimeGrouper
How can I group this data by the Branch and on a 20 day period using TimeGrouper?
All my previous attempts failed, because I could not combine TimeGrouper with another argument in the groupby function.
I would deeply appreciate your help.
Thank you
Andy