title: python pandas data frame if else without iterating thought data frame
body: <p>I want to add a column to a df. The values of this new df will be dependent upon the values of the other columns. eg</p>
  
  <pre><code>dc = {'A':[0,9,4,5],'B':[6,0,10,12],'C':[1,3,15,18]}
  df = pd.DataFrame(dc)
     A   B   C
  0  0   6   1
  1  9   0   3
  2  4  10  15
  3  5  12  18
  </code></pre>
  
  <p>Now I want to add another column D whose values will depend on values of A,B,C.
  So for example if was iterating through the df I would just do:</p>
  
  <pre><code>for row in df.iterrows():
      if(row['A'] != 0 and row[B] !=0):
           row['D'] = (float(row['A'])/float(row['B']))*row['C']
      elif(row['C'] ==0 and row['A'] != 0 and row[B] ==0):
           row['D'] == 250.0
      else:
           row['D'] == 20.0 
  </code></pre>
  
  <p>Is there a way to do this without the for loop or using where () or apply () functions. </p>
  
  <p>Thanks</p>