Group by and find top n value_counts pandas : <p>I have a dataframe of taxi data with two columns that looks like this:</p>

<pre><code>Neighborhood    Borough        Time
Midtown         Manhattan      X
Melrose         Bronx          Y
Grant City      Staten Island  Z
Midtown         Manhattan      A
Lincoln Square  Manhattan      B
</code></pre>

<p>Basically, each row represents a taxi pickup in that neighborhood in that borough. Now, I want to find the top 5 neighborhoods in each borough with the most number of pickups. I tried this:</p>

<pre><code>df['Neighborhood'].groupby(df['Borough']).value_counts()
</code></pre>

<p>Which gives me something like this:</p>

<pre><code>borough                          
Bronx          High  Bridge          3424
               Mott Haven            2515
               Concourse Village     1443
               Port Morris           1153
               Melrose                492
               North Riverdale        463
               Eastchester            434
               Concourse              395
               Fordham                252
               Wakefield              214
               Kingsbridge            212
               Mount Hope             200
               Parkchester            191
......

Staten Island  Castleton Corners        4
               Dongan Hills             4
               Eltingville              4
               Graniteville             4
               Great Kills              4
               Castleton                3
               Woodrow                  1
</code></pre>

<p>How do I filter it so that I get only the top 5 from each? I know there are a few questions with a similar title but they weren't helpful to my case.</p>
