Reputation: 97
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!
Upvotes: 0
Views: 50
Reputation: 234
Assuming that you want to start from the first empty header, then:
df = df[df.columns[list(df.columns).index('Unnamed: 1'):]]
Upvotes: 1