My groupby code works fine:
df_20.groupby(['Jaar'])['GemeenteNaam'].value_counts()
It groups year 2015, 2016, 2017, 2018. How often a GemeenteNaam (in English: city name) is found in the column ['GemeenteNaam'] is given for every year with value_counts().
But this results in over 100 city's per year in my groupby result. I only want 10 city's per year.
Question: how can I limit the rows as a result of the groupby?
I tried this, but this of coure limits the total result:
df_20.groupby(['Jaar'])['GemeenteNaam'].value_counts().head(10)
I checked the groupby docstring, but couldn't find an answer. Hopefully you are smarter then I am (probably...). Thanks in advance!! greetings Jan (from rainy Netherlands).