intent: Pandas: How can I remove duplicate rows from DataFrame and calculate their frequency?
rewritten_intent: remove duplicate rows from dataframe `df1` and calculate their frequency
snippet: df1.groupby(['key', 'year']).size().reset_index()