I want merge two series effectively, S1 = pd.Series(["A", "B"])
and S2 = pd.Series([1, 2, 3])
.
Result dataframe is like below:
S1 S2
0 A 1
1 A 2
2 A 3
3 B 1
4 B 2
5 B 3
One way:
df = S1.to_frame(name='S1').merge(S2.to_frame(name='S2'), how='cross')
OUTPUT:
S1 S2
0 A 1
1 A 2
2 A 3
3 B 1
4 B 2
5 B 3