Issue
I have an excel workbook with multiple sheets and I am trying to import/read the data starting from an empty col.
the row data look like this
A | C | |
---|---|---|
One | Two | Three |
and I am trying to get the data
C | |
---|---|
Two | Three |
I can't use usecols as the position of this empty col changes in each sheet I have in the workbook.
I have tried this but didn't work out for me.
df = df[~df.header.shift().eq('').cummax()]
I would appreciate any suggestions or hints. Mant thanks in advance!
Solution
Assuming that you want to start from the first empty header, then:
df = df[df.columns[list(df.columns).index('Unnamed: 1'):]]
Answered By - garagnoth
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.