data_dict = {'A': [1,3,3], 'B': [2,3,3]}
convert to
A 1
A 3
A 3
B 2
B 3
B 3
I tried to loop, but it is not simple enough. Is there any more simple method?
CodePudding user response:
data_dict = {'A': [1,3,3], 'B': [2,3,3]}
s = pd.Series(data_dict).explode()
print(s)
A 1
A 3
A 3
B 2
B 3
B 3
dtype: object