title: Python: Create new dataframe column that shows a ranking relative to other column values
body: <p>Original dataframe in python:</p>
  <pre><code>    date       cash  hy    equity  
  0  2003-01-31   1    3       4                    
  1  2003-01-31   2    5       1                     
  2  2003-01-31   1    6       3              
  
  </code></pre>
  <p>Goal: Create three new columns that rank each asset class relative to the other two. 0 = lowest return asset class. 2 = highest returning asset class.</p>
  <pre><code>    date       cash  hy    equity  cash_rank    hy_rank    equity_rank
  0  2003-01-31   1    3       4          0        1            2
  1  2003-01-31   2    5       1          1        2            0
  2  2003-01-31   1    6       3          0        2            1
  
  </code></pre>
  <p>I was using the code below:</p>
  <pre><code>x = [2, 5, 1]
  arranged = sorted(x)
  
  sorted_list =  []
  
  for i in x:
      sorted_list.append(arranged.index(i))
  
  </code></pre>
  <p>This returns the new sorted_list = [1, 2, 0] which is the order of the asset class returns in the second row.</p>
  <p>I can't figure out how to apply this to the rank columns with the dataframe.apply() method or any other method.</p>