title: Pandas DataFrame assign hirachic number to element
body: <p>I have the following Dataframe:</p>
  
  <pre><code>   a  b  c  d
  0  1  4  9  2
  1  2  5  8  7
  2  4  6  2  3
  3  3  2  7  5
  </code></pre>
  
  <p>I want to assign a number to each element in a row according to it's order.  The result should look like this: </p>
  
  <pre><code>   a  b  c  d
  0  1  3  4  2
  1  1  2  4  3
  2  3  4  1  2
  3  2  1  4  3 
  </code></pre>
  
  <p>I tried to use the np.argsort function which doesn't work. Does someone know an easy way to to this? Thanks.</p>