title: if statement between values of two pandas Dataframes
body: <p>I want to make an if statement with the values of two pandas data frames (the values I want to compare are in column 0):</p>
  
  <p>EDIT:</p>
  
  <p>First of all I wanted to check the number of times at which the value of df1 is greater than the value of df2.</p>
  
  <pre><code>for row in df1:
      if df1[0] &gt; df2[0]:
         Print('Ok')
      else:
         Print('not OK')
  </code></pre>
  
  <p>and what I get is:</p>
  
  <blockquote>
    <p>ValueError: The truth value of a Series is ambiguous. Use a.empty,
    a.bool(), a.item(), a.any() or a.all().</p>
  </blockquote>
  
  <p>EDIT No. 2:</p>
  
  <p>Since I hadn't time to try all your proposals and due to the fact that I needed a quick solution, here is what I got along with:</p>
  
  <pre><code>excessLoadB1l=[]
  
  indexYB1=loadC1C2B1.index.tolist()
  
  tempLB1=energyBalanceB1['sumSupply_B1'].tolist()
  
  for item in tempLB1:
  
      if item &lt; 0:
  
          item=item
  
      else:
  
          item=0
  
      excessLoadB1l.append(item)
  
  excessLoadB1=pd.DataFrame({'excessLoadB1':excessLoadB1l}).set_index([indexYB1])
  </code></pre>
  
  <p>I created a list out of the positive and negative values</p>
  
  <blockquote>
    <p>tempLB1=energyBalanceB1['sumSupply_B1'].tolist()</p>
  </blockquote>
  
  <p>which I wanted to separate in two different DataFrames. I borrowed the index from </p>
  
  <blockquote>
    <p>indexYB1=loadC1C2B1.index.tolist()</p>
  </blockquote>
  
  <p>and for the positive values:</p>
  
  <pre><code>excessSupplyB1l=[]
  
  indexZB1=loadC1C2B1.index.tolist()
  
  tempSB1=energyBalanceB1['sumSupply_B1'].tolist()
  
  for item in tempSB1:
  
      if item &gt; 0:
  
          item=item
  
      else:
  
          item=0
  
      excessSupplyB1l.append(item)
  
  
  excessSupplyB1=pd.DataFrame({'excessSupplyB1':excessSupplyB1l}).set_index([indexZB1])
  </code></pre>