Reputation: 493
I have a pandas data frame with multiple lists. Is there any way to combine all of the lists from all rows ( there could be 100 rows ) into one big list?
fruits
0 [apple, banana, orange]
1 [berry, lemon]
2 [apple, tomato]
3 [lime, orange, banana]
Expected Output
[ 'apple', 'banana', 'orange', 'berry', 'lemon', 'apple', 'tomato', 'lime', 'orange', 'banana' ]
Upvotes: 1
Views: 2899
Reputation: 185
Try extend :
result = []
for row in fruits :
result.extend(row)
Upvotes: 2