Suppose I have a pandas dataframe with a series C where each value is a list. Since the length of each list is different, How do I slice and append this series to new columns of this DataFrame ?
Additional findings: Starting with [ , and ', each letter is appended to the whole list (blanc space included to separate the word)
What should I do to combine the letters into a single word then apply the solutions?
Sample df -
id A B C
0 1 2 ['Alan', 'Rod', 'Ben']
1 1 3 ['Jeff']
2 4 6 ['Pete', 'Joe']
Intermediate df -
id A B C N1 N2 N3 N4 ....
0 1 2 ['Alan', 'Rod', 'Ben'] [ ' A l
1 1 3 ['Jeff'] [ ' J e
2 4 6 ['Pete', 'Joe'] [ ' P e
Expected df -
id A B C N1 N2 N3
0 1 2 ['Alan', 'Rod', 'Ben'] 'Alan' 'Rod' 'Ben'
1 1 3 ['Jeff'] 'Jeff' Nan Nan
2 4 6 ['Pete', 'Joe'] 'Pete' 'Joe' Nan