title: list comprehension in pandas
body: <p>I'm giving a toy example but it will help me understand what's going on for something else I'm trying to do. Let's say I want a new column in a dataframe 'optimal_fruit' that is apples * orange - bananas.</p>
  
  <p>I can do something like this to get it. </p>
  
  <pre><code>df2['optimal_fruit'] = df2['apples'] * df2['oranges'] - df2['bananas'] 
  
  
  apples  oranges bananas optimal_fruit
  1       6       11      -5
  2       7       12      2
  3       8       13      11
  4       9       14      22
  5       10      15      35
  </code></pre>
  
  <p>What is happening if I try to do something like this? And how could I do this in a list comprehension?</p>
  
  <pre><code>df2['optimal_fruit'] = [x * y - z for x in df2['apples'] for y in df2['oranges'] for z in df2['bananas']]
  </code></pre>
  
  <p>I get an error of:</p>
  
  <p>ValueError: Length of values does not match length of index</p>
  
  <p>As always, thank you all so much for your help!</p>