0

A slight variant to other similar questions.

I want to split the column lists of unequal length and attach results back into original dataframe

Df1

ID      Start                   Name
41625000    25/02/2020 09:34:22 ['A', 'B]
41625000    25/02/2020 09:34:22 ['A', 'B']
40250000    25/02/2020 09:34:22 ['C']
40250000    25/02/2020 09:34:22 ['C']
40250001    25/02/2020 09:34:22 ['C', 'D', 'E']

I would like the end result to look like:

ID      Start                  Name2  Name3  Name4
41625000    25/02/2020 09:34:22 A      B
41625000    25/02/2020 09:34:22 A      B
40250000    25/02/2020 09:34:22 C      
40250000    25/02/2020 09:34:22 C
40250001    25/02/2020 09:34:22 C      D      E

I will be grateful for any help!

Deluxe88888
  • 113
  • 6
  • `df.join(pd.DataFrame(df['Name'].tolist()))` ? – anky May 09 '20 at 17:30
  • comes up with TypeError: object of type 'float' has no len() @anky – Deluxe88888 May 09 '20 at 17:33
  • Kindly take a look here: [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) and also the linked duplicate. – anky May 09 '20 at 17:35

0 Answers0