0

I have this dataframe ('mass_grouped3'):

value1 value2
aaa    (123, 1234)
bbb    (321, 4321)

I want to transform it into this:

value1 value2
aaa    123
aaa    1234
bbb    321
bbb    4321

I want to create new dataframe, I am using this code:

new_df = ({'value2' : [item for sublist in mass_grouped3['samples_from_tuple'] for item in sublist], 'value1' : mass_grouped3['value1']}

But the part of the code for the second value of the new df is not working. Any ideas?

Y.C.T
  • 125
  • 12

0 Answers0