I have a dataframe df as where Col1, Col2 and Col3 are column names:
Col1 Col2 Col3
a b
B 2 3
C 10 6
First row above with values a, b is subcategory so Col1 is empty for row 1.
I am trying to get the following:
B Col2 a 2
B Col3 b 3
C Col2 a 10
C Col3 b 6
I am not sure how to approach above.
Edit:
df.to_dict()
Out[16]:
{'Unnamed: 0': {0: nan, 1: 'B', 2: 'C'},
'Col2': {0: 'a', 1: '2', 2: '10'},
'Col3': {0: 'b', 1: '3', 2: '6'}}