title: For loop using np.where
body: <p>I'm trying to create a new column in a dataframe that labels animals that are domesticated with a 1. I'm using a for loop, but for some reason, the loop only picks up the last item in the <code>pets</code> list. <code>dog</code>, <code>cat</code>, and <code>gerbil</code> should all be assigned a 1 under the <code>domesticated</code> column. Anyone have a fix for this or a better approach?</p>
  
  <pre><code>df = pd.DataFrame(
      {'creature': ['dog', 'cat', 'gerbil', 'mouse', 'donkey']
      })
  
  pets = ['dog', 'cat', 'gerbil']
  
  for pet in pets:
      df['domesticated'] = np.where(df['creature']==pet, 1, 0)
  
  df
  </code></pre>