title: How to fill in empty column in a dataframe with a particular element from the list of another column?
body: <p>Having a dataframe consisting of a person and the order...</p>
  
  <pre><code>person     order                                 elements
  Alice      [drink, snack, salad, fish, dessert]  5          
  Tom        [drink, snack]                        2          
  John       [drink, snack, soup, chicken]         4          
  Mila       [drink, snack, soup]                  3          
  </code></pre>
  
  <p>I want to known what customers had as a main meal. Thus, I want to add another column [main_meal] so that would be my df.</p>
  
  <pre><code>person     order                               elements   main_meal
  Alice      [drink, snack, salad, fish, dessert]  5          fish
  Tom        [drink, snack]                        2          none
  John       [drink, snack, soup, chicken]         4          chicken
  Mila       [drink, snack, soup]                  3          none
  </code></pre>
  
  <p>The rule is that if a customer ordered 4 or more meals, it means the 4th element is always the main dish, so I want to extract the 4th element from the list on the order column. If it contains less than 4 elements, then assign 'main_meal' to none. My code:</p>
  
  <pre><code>df['main_meal'] = ''
  if df['elements'] &gt;= 4:
       df['main_meal'] = df.order[3]
  else:
       df['main_meal'] = 'none'
  </code></pre>
  
  <p>It doesn't work:</p>
  
  <pre><code> ValueError                                Traceback (most recent call last)
   &lt;ipython-input-100-39b7809cc669&gt; in &lt;module&gt;()
       1 df['main_meal'] = ''
       2 df.head(5)
   ----&gt; 3 if df['elements'] &gt;= 4:
         4     df['main_meal'] = df.order[3]
         5 else:
  
   ~\Anaconda\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
   1571         raise ValueError("The truth value of a {0} is ambiguous. "
   1572                          "Use a.empty, a.bool(), a.item(), a.any() or 
   a.all()."
   -&gt; 1573                          .format(self.__class__.__name__))
   1574 
   1575     __bool__ = __nonzero__
  
   ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  
  <p>What is wrong with my code?</p>