title: Find max value in row and fill new column with that columns name using Pandas?
body: <p>I have a Pandas dataframe that looks like this:</p>
  
  <pre><code>Index, cat1, cat2, cat3
  1,0.3,0.1,0.4
  2,0.5,0.1,0.2
  3,0.1,0.4,0.3
  </code></pre>
  
  <p>I want to create a fifth column "max_cat" with the column name of the category with the highest value like so:</p>
  
  <pre><code>Index, cat1, cat2, cat3, max_cat
  1,0.3,0.1,0.4, cat3
  2,0.5,0.1,0.2, cat1
  3,0.1,0.4,0.3, cat2
  </code></pre>
  
  <p>How would I go about achieving that, preferably using Pandas?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import pandas as pd
  from io import StringIO
  data = StringIO("""
  Index, cat1, cat2, cat3
  1,0.3,0.1,0.4
  2,0.5,0.1,0.2
  3,0.1,0.4,0.3
  """)
  df = pd.read_csv(data, skiprows=1, header=0, names=["cat1","cat2","cat3"])
  </code></pre>