title: Column name corresponding to largest value in pandas DataFrame
body: <p>for below dataframe data:</p>
  
  <pre><code>x  y  a b c 
  2  6 12 1 2
  1  2  4 6 8
  </code></pre>
  
  <p>I want result in new column(i.e d) that returns name of column with max value only among a,b,c.</p>
  
  <pre><code>cols
  a
  c
  </code></pre>
  
  <p>I'm trying to find maximum values from three columns and return column name.But instead of selecting all the rows of dataset,I want to select rows of only these three columns.I'm using the following code:</p>
  
  <pre><code>def returncolname(row, colnames):
      return colnames[np.argmax(row.values)]
  data['colmax'] = data.apply(lambda x: returncolname(x, data.columns), axis=1)
  </code></pre>