I have a csv sheet with multiple tables per sheet like this:
Name Header-1 Header-8 Header 3
Random Note
Jack X X
Jane X
NAN NAN NAN NAN
Name Header 3 Header 2 Header 7
Random note
Jeremy X X
Joey X
Could I split the tables by blank rows then reshape them into one dataframe to result like this:
Name Header-1 Header-2 Header-3 .....
Jack X
Jane X
Jeremy X
Joey X X X
I would like to use the blank rows as a new index and read each table as a new df. The headers of each table are the same, they're just not all in the right order. Eventually - I'd like to stitch them back together into one clean DF.
Lets suppose you have the csv set as follows:
You can work on this file with following code which is self explanotary:
So your input is:
Note that in this example header is in different order in second dataframe to extract.
And your output would be: