Group a pandas data frame by monthly frequenct `M` using groupby,df.groupby(pd.TimeGrouper(freq='M'))