import pandas a=pandas.DataFrame({'Country': ['China,US', 'Japan,EU', 'UK,Australia', 'Singapore,Netherland'], 'Number': [100, 150, 120, 90], 'Value': ...
import pandas a=pandas.DataFrame({'Country': ['China,US', 'Japan,EU', 'UK,Australia', 'Singapore,Netherland'], 'Number': [100, 150, 120, 90], 'Value': [1, 2, 3, 4], 'label': list('abcd')}) a_split = a.drop('Country', axis=1).join(a['Country'].str.split(',',expand=True)).stack().reset_index(drop=True,level=1).rename('coun') print(a_split)
0 100
0 1
0 a
0 China
0 US
1 150
1 2
1 b
1 Japan
1 EU
2 120
2 3
2 c
2 UK
2 Australia
3 90
3 4
3 d
3 Singapore
3 Netherland
Name: coun, dtype: object