So, have a look at the following code:
import numpy as np
import pandas as pd
def answer_one():
energy = pd.read_excel(io = "Energy Indicators.xls", header = 9, parse_cols = "C:F", skip_footer = 38)
return energy
answer_one()
It produces the following output:
Now, when I make a little modification to the code, as below, it changes the output completely:
def answer_one():
energy = pd.read_excel(io = "Energy Indicators.xls", header = 9, parse_cols = "C:F", skip_footer = 38, skiprows = 8)
return energy
answer_one()
The output that I get is as follows:
Depending upon the argument that I give to the "skiprows" parameter, the output changes itself. I am unable to understand why does changing the value of "skiprows" affect the headers of the dataframe, when we are keeping the argument of the "headers"parameter unchanged? Please find the data file (.xlsx file) here
Any help please? I use Pandas v0.19.2. Also, please don't tag my question as "duplicate". I lose points man. I tried reasonably well to find an existing question, but could not.