Reputation: 429
I wanted to create just one row of column names in the data frame but ended up with a weird format:
pd.read_excel('filename.xlsx', sheet_name = 'sheetnamehere', skiprows = 4, nrows = 60, header = [0,2])
Is it possible to create a data frame with just one row of column names in the following format?
Quarter|America|Southeast Asia|Greater China|North Asia|South Asia|....
Upvotes: 0
Views: 329
Reputation: 10624
If the rest of your data is ok, best way is to define your columns after df creation with
df.columns=['Quarter', 'America', 'Southeast Asia', 'Greater China' ,'North Asia','South Asia',... etc]
If rest of the data is loaded weirdly, please paste a bigger sample so that we will investigate.
Upvotes: 1