1

I am not able to find how to index my dataframe columns properly

I tried some methods but not able to find right one

import pandas as pd

df = pd.read_html('sbi.html')
data = df[1]

Screenshot

i want the second row as my index of columns in which "Narration" is there

1 Answer 1

1

Set header parameter to 1:

data = pd.read_html('sbi.html', header=1)[0]

Or use skiprows parameter:

data = pd.read_html('sbi.html', skiprows=1)[0]
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks this solved my problem data = pd.read_html('sbi.html', header=0)[1]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.