1

This is how the pandas dataframe looks like:

A B C D
A1 ['Bb1'] [54] [84.0]
A2 ['Bb2'] [63] [nan]

Following is how the dataframe should be:

A B C D
A1 Bb1 54 84.0
A2 Bb2 63 nan
SaVi
  • 11
  • 2

1 Answers1

2

As of pandas 1.3.0:

df.explode(['B', 'C', 'D'])

Or before:

df.set_index('A').apply(pd.Series.explode).reset_index()
U13-Forward
  • 69,221
  • 14
  • 89
  • 114