Skip to content
Advertisement

Pandas: reading Excel file starting from the row below that with a specific value

Say I have the following Excel file:

JavaScript

I want to read the file in a dataframe making sure that I start to read it below the row where the Start value is.

Attention: the Start value is not always located in the same row, so if I were to use:

JavaScript

this would fail as skiprows needs to be fixed. Is there any workaround to make sure that xls.parse finds the string value instead of the row number?

Advertisement

Answer

JavaScript

This answer helps in finding the location of ‘start’ in the df

JavaScript

after having row_start you can use subframe of pandas

JavaScript

And if you don’t need the row containing ‘start’, just u increment row_start by 1

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement