human
Pandas: How can I remove duplicate rows from DataFrame and calculate their frequency?
assistant
Here is some code to remove duplicate rows from dataframe `df1` and calculate their frequency

df1.groupby(['key', 'year']).size().reset_index()

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.