Pandas - combine column values into a list in a new column Pandas - combine column values into a list in a new column python python

Pandas - combine column values into a list in a new column


try this :

t['combined']= t.values.tolist()tOut[50]:          A         B     C        D                       combined0    hello         1  GOOD  long.kw      [hello, 1, GOOD, long.kw]1     1.20  chipotle   NaN    bingo    [1.2, chipotle, nan, bingo]2  various       NaN  3000   123.46  [various, nan, 3000, 123.456]