title: Pandas - combine column values into a list in a new column
body: <p>I have a Python Pandas dataframe df:</p>
  <pre><code>d = [['hello', 1, 'GOOD', 'long.kw'],
       [1.2, 'chipotle', np.nan, 'bingo'],
       ['various', np.nan, 3000, 123.456]]
  t = pd.DataFrame(data=d, columns=['A','B','C','D']) 
  </code></pre>
  <p>which looks like this:</p>
  <pre><code>print(t)
           A         B     C        D
  0    hello         1  GOOD  long.kw
  1      1.2  chipotle   NaN    bingo
  2  various       NaN  3000  123.456
  </code></pre>
  <p>I am trying to create a new column which is a <code>list</code> of the values in <code>A</code>, <code>B</code>, <code>C</code>, and <code>D</code>.  So it would look like this:</p>
  <pre><code>t['combined']                                             
  
  Out[125]: 
  0        [hello, 1, GOOD, long.kw]
  1        [1.2, chipotle, nan, bingo]
  2        [various, nan, 3000, 123.456]
  Name: combined, dtype: object
  </code></pre>
  <p>I am trying this code:</p>
  <pre><code>t['combined'] = t.apply(lambda x: list([x['A'],
                                          x['B'],
                                          x['C'],
                                          x['D']]),axis=1)    
  </code></pre>
  <p>Which returns this error:</p>
  <pre><code>ValueError: Wrong number of items passed 4, placement implies 1 
  </code></pre>
  <p>What is puzzling to me is if I remove one of the columns that I want to put in the list (or add another column to the dataframe that I DON'T add to the list), my code works.</p>
  <p>For instance, run this code:</p>
  <pre><code>t['combined'] = t.apply(lambda x: list([x['A'],
                                          x['B'],
                                          x['D']]),axis=1)      
  </code></pre>
  <p>Returns this which is perfect if I only wanted the 3 columns:</p>
  <pre><code>print(t)
           A         B     C        D                 combined
  0    hello         1  GOOD  long.kw      [hello, 1, long.kw]
  1      1.2  chipotle   NaN    bingo   [1.2, chipotle, bingo]
  2  various       NaN  3000  123.456  [various, nan, 123.456]
                                      
  </code></pre>
  <p>I am at a complete loss as to why requesting the 'combined' list be made of all columns in the dataframe would create an error, but selecting all but 1 column to create the 'combined' list works as expected.</p>