I have a dataset with header level rows
header_col1 header_col2 item_col1
A 111 apple | banana
B 222 apple
C 333 pear | grapes
D 444 grapes
I would like to transform this dataset so that each row in the table represents an item instead a header. That is:
header_col1 header_col2 item_col1
A 111 apple
A 111 banana
B 222 apple
C 333 pear
C 333 grapes
D 444 grapes
Is there any simple way to do this with pandas? All I can think of are