title: Function to iterate through a pd.DataFrame and return a list not working properly, returns only an empty string
body: <p>Trying to create a function that would go through rows in a column called <code>df['loan status']</code>, and assign values 1 or 0 to list <code>loan_repaid</code> based on whether <code>loan_status</code> is &quot;Fully Paid&quot; or &quot;Charged Off&quot;. The column always only contains one of the two.</p>
  <pre><code>loan_repaid = [] 
  
  def get_binary():
      for x in df['loan_status']:
          if &quot;FUlly Paid&quot; in df['loan_status']:
              loan_repaid.append(1)
          if 'Charged Off' in df['loan_status']:
              loan_repaid.append(0)
          else: 
              pass
  </code></pre>
  <p>Unfortunately my attempt does nothing, and just returns an empty list :).</p>
  <p>I peaked at the solution in the course that I am following and it goes with a more elegant solution:</p>
  <pre><code>df['loan_repaid'] = df['loan_status'].map({'Fully Paid':1,'Charged Off':0})
  </code></pre>
  <p>Which makes perfect sense, but I'd still like to know why my function isn't working.</p>