title: ValueError: Shape of passed values is X, indices imply Y in pandas apply and transform
body: <p>I've got 8-column data frame and would like to have another one with 2 columns. Values in those 2 columns are calculated from original 8 values.</p>
  
  <p>Is it possible to do with <code>apply</code> or <code>transform</code>?</p>
  
  <p>Example:</p>
  
  <pre><code>jnd = pd.DataFrame(np.random.rand(18, 8))
  
  def appl(s):
      """particular processing is not important, only shapes matter.
         Therefore just randomly select 2 of passed values"""
      return np.random.choice(s, size=2)
  
  jnd.apply(appl, axis=1)
  </code></pre>
  
  <p>This raises </p>
  
  <pre><code>ValueError: Shape of passed values is (18, 2), indices imply (18, 8)
  </code></pre>
  
  <p>Same thing for <code>transform</code>.</p>