title: Python Pandas dataframe add "1" in new column if ID exists in other dataframe
body: <p>I have two dataframes with customer IDs (labeled "C_ID") and with the number of visits for a year. </p>
  
  <p>I want to add a column in my 2010 dataframe, if the customer also shopped in 2009. So I need to create a loop checking if the C_ID from 2010 exist in 2009, add a 1, otherwise a 0. </p>
  
  <p>I used this code and didn't work: (no error message, nothing happens)</p>
  
  <pre><code>for row in df_2010.iterrows():
      #check if C_ID exists in the other dataframe
      check = df_2009[(df_2009['C_ID'] == row['C_ID'])]
  
      if check.empty:
          #ID not exist in 2009 file, add 0 in new column
          row['shopped2009'] = 0
  
      else:
          #ID exists in 2009 file, add 1 into same column
          row['shopped2009'] = 1
  </code></pre>