how to group by dates in pandas code example Example: groupby year datetime pandas data.groupby(data.date.dt.year)