title: Python loop over values in dataframe and change to binary values
body: <p>I have a series <code>y</code> in Python with values <code>Accepted</code> and <code>Rejected</code>. I want to create a new dataframe with value <strong>1</strong> for <code>Accepted</code> and <strong>0</strong> for <code>Rejected</code>. </p>
  
  <p>I'm trying to loop through the values of <code>y</code> and write to a new df <code>dummy</code>. My progress so far is</p>
  
  <pre><code>dummy=pd.DataFrame()
  i=0
  
  for i in range(0,len(y)):
      if y[i]=='Approved': 
          dummy[i:]==1
      else: 
          dummy[i:]==0
  </code></pre>
  
  <p>but I got a feeling that I'm off track. Can anyone help me out? </p>
  
  <p>The series <code>y</code> looks like this:</p>
  
  <pre><code>   y
  Accepted
  Rejected
  Accepted
  Accepted
  Accepted
  </code></pre>
  
  <p>The desired output should be something like</p>
  
  <pre><code>dummy
    1
    0
    1
    1
    1
  </code></pre>