1

An example of my df:

Index   time            type    pwa0            pwa1    pwa2
63      16:05:03        nonJ    [20:733:845]    []      [2750]

I would like to split the columns having no, one or multiple values (pwa0, pwa1 and pwa2) like this:

Index   time            type    pwa0    pwa1    pwa2
63      16:05:03        nonJ    20              2750
63      16:05:03        nonJ    733     
63      16:05:03        nonJ    845     

In contrast to the possible shown duplicate, the to be splitted columns are not correlated. The split order per column should just be order based: first the first value, then the second etc. If no values are present in a column, the cell should remain empty. Any suggestions will be highly appreciated!

Desie
  • 13
  • 3
  • What is `[20:733:845]`? Is that a list with a single string value? Or a string which starts and ends with square brackets? – jpp Sep 24 '18 at 11:58
  • It is a string starting and ending with square brackets. – Desie Sep 24 '18 at 12:36
  • 1
    Seems duplicate, look at [split-explode-pandas-dataframe-string-entry-to-separate-rows](https://stackoverflow.com/questions/12680754/split-explode-pandas-dataframe-string-entry-to-separate-rows). – nandneo Sep 24 '18 at 12:43
  • Possible duplicate of [Split (explode) pandas dataframe string entry to separate rows](https://stackoverflow.com/questions/12680754/split-explode-pandas-dataframe-string-entry-to-separate-rows) – Andrew Sep 24 '18 at 13:46
  • Looked into the possible duplicate, thanx for the link. Still stuck here. Can't get the answers to work for multiple columns containing a variable amount of values. – Desie Sep 24 '18 at 13:56

0 Answers0