title: TypeError when trying to run function on Pandas Dataframe
body: <p>I have a pandas dataframe called <code>month_values</code> with values such as the following:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Area</th>
  <th>Thrpt_A</th>
  <th>Thrpt_B</th>
  <th>Thrpt_C</th>
  <th>Thrpt_D</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Galle</td>
  <td>9581.539079</td>
  <td>6790.664649</td>
  <td>8340.489900</td>
  <td>5940.886763</td>
  </tr>
  <tr>
  <td>Colombo</td>
  <td>5948.006563</td>
  <td>4245.619220</td>
  <td>7084.931812</td>
  <td>3915.933362</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The datatypes are</p>
  <pre><code>Area             object
  Thrpt_A          float64
  Thrpt_B          float64
  Thrpt_C          float64
  Thrpt_D          float64
  </code></pre>
  <p>I've defined a function with nested if-else to be applied to this dataframe as follows:</p>
  <pre><code>def mark_func(df):
      if (df['Area'] == &quot;Colombo&quot;):
          if (df['Thrpt_A'] &gt;= 8000):
              return 'A'
          elif (df['Thrpt_A'] &lt; (8000)):
              if (df['Thrpt_A'] &gt;= df['Thrpt_B']) and (['Thrpt_A'] &gt;= df['Thrpt_C']) and (['Thrpt_A'] &gt;= df['Thrpt_D']):
                  return 'A'
              elif (df['Thrpt_B'] &gt;= df['Thrpt_C']) and (df['Thrpt_B'] &gt;= df['Thrpt_D']):
                  return 'B'
              elif (df['Thrpt_C'] &gt;= df['Thrpt_B']) and (df['Thrpt_C'] &gt;= df['Thrpt_D']):
                  return 'C'
              elif (df['Thrpt_D'] &gt;= df['Thrpt_B']) and (df['Thrpt_D'] &gt;= df['Thrpt_C']):
                  return 'D'
      else:
          if (df['Thrpt_A'] &gt;= 4000):
              return 'A'
          elif (df['Thrpt_A'] &lt; (4000)):
              if (df['Thrpt_A'] &gt;= df['Thrpt_B']) and (['Thrpt_A'] &gt;= df['Thrpt_C']) and (['Thrpt_A'] &gt;= df['Thrpt_D']):
                  return 'A'
              elif (df['Thrpt_B'] &gt;= df['Thrpt_C']) and (df['Thrpt_B'] &gt;= df['Thrpt_D']):
                  return 'B'
              elif (df['Thrpt_C'] &gt;= df['Thrpt_B']) and (df['Thrpt_C'] &gt;= df['Thrpt_D']):
                  return 'C'
              elif (df['Thrpt_D'] &gt;= df['Thrpt_B']) and (df['Thrpt_D'] &gt;= df['Thrpt_C']):
                  return 'D'
  </code></pre>
  <p>The output I'm expecting is as follows:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Area</th>
  <th>Thrpt_A</th>
  <th>Thrpt_B</th>
  <th>Thrpt_C</th>
  <th>Thrpt_D</th>
  <th>Mark</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Galle</td>
  <td>9581.539079</td>
  <td>6790.664649</td>
  <td>8340.489900</td>
  <td>5940.886763</td>
  <td>A</td>
  </tr>
  <tr>
  <td>Colombo</td>
  <td>5948.006563</td>
  <td>4245.619220</td>
  <td>7084.931812</td>
  <td>3915.933362</td>
  <td>C</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>However, when I apply the function using the following line of code:</p>
  <pre><code>month_values['Mark'] = month_values.apply(mark_func, axis=1)
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>TypeError: (&quot;'&gt;=' not supported between instances of 'list' and 'float'&quot;, 'occurred at index 279')
  </code></pre>
  <p>I'm not exactly sure what I'm doing wrong here. Would be grateful for any suggestion to resolve the issue.</p>