title: Python: new data frame from group_by with new index in one line
body: <p>I am new to Python and would like to get more efficient in coding. </p>
  
  <p>Currently I have the following code, counting the number of shops per city, if the shop is still open: </p>
  
  <pre><code>top_20_cities = pd.DataFrame(data = shops[shops.Open == 'Open'].groupby('city').size().sort_values(ascending=False).head(20)).reset_index()
  top_20_cities.columns = ['City', 'Count']
  </code></pre>
  
  <p>Is it possible, put both lines into one? I tried this, but get an error: </p>
  
  <pre><code>top_20_cities = pd.DataFrame(data = shops[shops.Open == 'Open'].groupby('city').size().sort_values(ascending=False).head(20), columns = ['City', 'Count']).reset_index()
  </code></pre>
  
  <p>thx</p>