I am reading a csv using pandas csv_reader that uses multiple rows for the headers. I am able to read in the file skip the required rows before the headers and also reset_index to not use the first column as I dont want my data to be the index. The trick is that after reading in the dataframe I need to try and perform two tasks. The top row doesn't repeat header names but is blank when it represents the last field filled in. I would like to "pivot" this header to a column leaving only the second header and filling in the respective blank cells.
an example of input would be like:
a b
c1 c2 c3 c1 c2 c3
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
what I am trying to output:
