I'm looking for the simplest way to create a data frame from two others such that it contains all combinations of their elements. For instance we have these two dataframes:
list1 = ["A", "B", "C", "D", "E"]
list2 = ["x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8"]
df1 = pd.DataFrame(list1)
df2 = pd.DataFrame(list2)
The result must be:
0 1
0 A x1
1 A x2
2 A x3
3 A x4
4 A x5
5 A x6
6 A x7
7 A x8
8 B x1
9 B x2
I tried to combine from the lists and it works fine with small lists but not for the large ones. Thank you