title: ValueError (while creating a function in python): The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
body: <pre><code>def function(df):
      if (df['Total'] &gt; 0) &amp; (df['Total'] &lt;= 50000):
           df['X'] = (df['Total']*(2/150)) * 0.2
      elif (df['Total'] &gt; 50000):
          df['X'] = ((50000*(2/150))*0.2) + ((df['Total']-50000)*(2/150)*0.2)
  </code></pre>
  
  <p>I am trying to run the above code but getting a value error saying </p>
  
  <pre><code>File "&lt;ipython-input-31-f77514d81c6f&gt;", line 1, in &lt;module&gt;
      platinumplus(cust_spends)
  
  File "&lt;ipython-input-30-da2fd213761f&gt;", line 2, in platinumplus
      if (df['Total'] &gt; 0) &amp; (df['Total'] &lt;= 50000):
  
  File "E:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py", 
      line 1573, in __nonzero__ .format(self.__class__.__name__))
  </code></pre>
  
  <blockquote>
    <p><strong>ValueError</strong>: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>
  </blockquote>