I have pandas dataframe that looks like the following.
The column props
contain lists and the elements in the list is varying in length. I know the maximum number of entries in the list is 5. I also know that the list is ordered, i.e. I know that the second item always belong to the column with a specific header say "Tense" or "number". Then how can I convert each of the entry in lists into separate columns?
id source type target props subtype
2 wyrzucić V wyrzucisz [FUT, 2, SG] NaN
6 śniadać V śniadać [NFIN] NaN
7 bankrutować V bankrutujący [PST, ACT, PL, MASC, HUM] PTCP
8 chwiać V będą chwiały [FUT, 3, PL] NaN
23 dobyć V dobyłaś [PST, 2, SG, FEM] NaN
I have tried solutions with usntack()
and also with tolist()
methods. But the solutions do not work for the specific case.