title: pandas DataFrame chooses the column value which all have the max occurrence frequency
body: <p>I am trying to choose a value from a column value occurrence count with the max frequency. There are edge cases when multiple values with the same frequency happened to be the maximum.</p>
  
  <p>What I do is to pick the value with the max aggregate sum of the values of another column of the rows this value belongs to.</p>
  
  <pre><code>max_cur_freq = df[df['currency'] != '']['currency'].mode().tolist()
  biggest_amount = 0.0
  biggest_amount_currency = ''
  for cur in max_cur_freq:
      if df[df['currency'] == cur]['amount'].agg('sum') &gt; biggest_amount:
         biggest_amount_currency = cur
         biggest_amount = df[df['currency'] == cur]['amount'].agg('sum')
  
  # assigns the currency with the largest sum amount as the values for column common_currency
  df['common_currency'] = biggest_amount_currency
  </code></pre>
  
  <p>so the code chooses the <code>currency</code> with the max <code>amount</code> sum on the rows, where this <code>currency</code> exists in the <code>DataFrame</code>.</p>
  
  <p>I am wondering whats the best way to do this.</p>
  
  <p>PS. a sample <code>DataFrame</code>,</p>
  
  <pre><code>   currency   amount
  50      CAD   410.85
  51      CAD   1441.68
  53      CAD   1330.33
  17625   JPY   2797856.0
  17663   JPY   1440.0
  17664   JPY   1445.33
  16734   CNY   27840.00
  54546   CNY   273269.53
  17654   GBP   384.0
  17655   GBP   526.0
  16732   CHF   474.7
  16733   CHF   195173.3
  </code></pre>