title: Create a new column in pandas taking into account a condition
body: <p>I am trying to create a new column from a condition, the idea is that if the first column has the value of 0 take column two, and if not leave the first column.</p>
  <pre><code>df1 = pd.DataFrame({
  'Buyer': ['Carl', 'Carl', 'Carl'],
  'Quantity': [18, 0, 5],
  'Hoja':[2,4,8],
  'Salida':[0,0,0]})
  
  def remean_points(row):
      if df1.Quantity==0:
          row.Salida = Quantity
      else:
          df1.Salida= row.Hoja
      return row
  
  df1.apply(remean_points, axis='columns')
  </code></pre>
  <p>However I find the following error, and I do not know how to solve it, I appreciate your help.</p>
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-20-7c3222c7a9a8&gt; in &lt;module&gt;
        6     return row
        7 
  ----&gt; 8 df1.apply(remean_points, axis='columns')
  
  C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in apply(self, func, axis, raw, result_type, args, **kwds)
     6876             kwds=kwds,
     6877         )
  -&gt; 6878         return op.get_result()
     6879 
     6880     def applymap(self, func) -&gt; &quot;DataFrame&quot;:
  
  C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\apply.py in get_result(self)
      184             return self.apply_raw()
      185 
  --&gt; 186         return self.apply_standard()
      187 
      188     def apply_empty_result(self):
  
  C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\apply.py in apply_standard(self)
      294             try:
      295                 result = libreduction.compute_reduction(
  --&gt; 296                     values, self.f, axis=self.axis, dummy=dummy, labels=labels
      297                 )
      298             except ValueError as err:
  
  pandas\_libs\reduction.pyx in pandas._libs.reduction.compute_reduction()
  
  pandas\_libs\reduction.pyx in pandas._libs.reduction.Reducer.get_result()
  
  &lt;ipython-input-20-7c3222c7a9a8&gt; in remean_points(row)
        1 def remean_points(row):
  ----&gt; 2     if df1.Quantity==0:
        3         row.Salida = Quantity
        4     else:
        5         df1.Salida= row.Hoja
  
  C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
     1477     def __nonzero__(self):
     1478         raise ValueError(
  -&gt; 1479             f&quot;The truth value of a {type(self).__name__} is ambiguous. &quot;
     1480             &quot;Use a.empty, a.bool(), a.item(), a.any() or a.all().&quot;
     1481         )
  
  ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>