title: pd.DataFrame['A'] if pd.DataFrame['B'] in a list
body: <h3>I'm stuck with this assignment:</h3>
  <p>I received a pd.DataFrame named 'foods' like this:</p>
  <pre><code>    foodname      fats
  0   Coconut oil   5
  1   Grape juice   10
  </code></pre>
  <p>Also I received a pd.Series named 'drinks' like this:</p>
  <pre><code>0   Water
  1   Grape juice
  </code></pre>
  <p>My task is to create a new column in foods named 'group', then check if foodname is in 'drinks' and if found, set 'group' value as 'drinks'</p>
  <p><strong>The final result should look like this:</strong></p>
  <pre><code>    foodname      fats  group
  0   Coconut oil   5     
  1   Grape juice   10    drinks
  </code></pre>
  <p>Then fill empties with 'Misc'</p>
  <pre><code>foods.['group'].fillna('Misc', inplace=True)
  </code></pre>
  <hr />
  <h3>I have tried:</h3>
  <p>Create a new empty column with:</p>
  <pre><code>foods['group'] = ''
  </code></pre>
  <p>Then, locate if a certain element name is in 'drinks' (this works):</p>
  <pre><code>drinks = list(drinks)
  foods.iloc[0]['foodname'] in drinks ---&gt; True / False
  </code></pre>
  <p>Then,</p>
  <pre><code>for i in list(foods.index):
      if foods.iloc[i]['foodname'] in drinks:
          foods.iloc[i]['group'] = 'drinks'
  </code></pre>
  <p>I get:</p>
  <pre><code>A value is trying to be set on a copy of a slice from a DataFrame
  IndexError: single positional indexer is out-of-bounds
  </code></pre>
  <p>Other tries:</p>
  <pre><code>foods.loc['group'][foods['foodname'] in drinks] = 'drinks'
  </code></pre>
  <hr />
  <p><strong>I would love to know</strong> how to deal correctly with this task. I understand that almost every time I am working with views and not with the 'real' DataFrame I think this has to do with this warning but I can't make it work.</p>
  <p>Thx in advance! Rgds!</p>