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