I have a lists of lists, that I want to convert to one row in a DataFrame. Each list should come in a cell in the DataFrame. When completed, I want to add the next list of lists in the same way.
This is what I do:
import pandas as pd
lst1 = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']]
lst2 = [['j', 'k', 'l'], ['m', 'n', 'o'], ['p', 'q', 'r']]
DataFrame = []
df = pd.DataFrame(lst1)
df = pd.DataFrame(lst2)
Resulting in:
0 1 2
0 j k l
1 m n o
2 p q r
But what I would like is this:
0 1 2
0 ['a', 'b', 'c'] ['d', 'e', 'f'] ['g', 'h', 'i']
1 ['j', 'k', 'l'] ['m', 'n', 'o'] ['p', 'q', 'r']
Is there a simpler and elegant way to do this?