title: Select top N rows by a specific sum value of one column in Python
body: <p>If I have a dataframe like this (I copy example dataframe from link in the end):</p>
  <pre><code>Browsers        Sessions
  Chrome          201
  IE              136
  Safari          101
  Firefox         36
  SamsungBrowse   12
  Opera           6  
  </code></pre>
  <p>I want <strong>top N rows</strong> of the sum value of <code>Sessions</code> is less than a given number say <strong>500</strong>? How can achieve that in Python? Thanks.</p>
  <pre><code>Browsers        Sessions
  Chrome          201
  IE              136
  Safari          101
  </code></pre>
  <p>This is what I have tried:</p>
  <pre><code>df = df[df['Session'].sum(axis=1) &gt; 500]
  </code></pre>
  <p>Here is a link for reference and where the example data I got.</p>
  <p><a href="https://stackoverflow.com/questions/41329031/python-pandas-how-to-get-top-n-values-and-the-sum-of-all-other-values">Python Pandas - how to get top n values and the sum of all other values</a></p>