here is my sample data:
df=pd.DataFrame({'Name':['A,B','C','D','E,F,G']
,'Age':[4,6,8,9]})
My expected output is to split the entries if there are more than one names.
pd.DataFrame({'Name':['A','B','C','D','E','F','G']
,'Age':[4,4,6,8,9,9,9]})
I can only split the name but I don't now how to make it duplicated entries. For first row, there are A,B under the Name, so I want to make it into two separate rows, A and B both are aged 4. Similarly, E,F,G are all aged at 9, so I want to convert this row into three rows with same age at 9.
df['Name'].apply(lambda x : x.split(','))