KahEm Chu
Apr 12, 2022

--

Hi Max,

Thanks for your kind words.

Regarding your question, if for pivot table, I have tested to run with data that start at row 8, as we use SourceData=ws1.UsedRange in the pivot_table function define, it can run normally.

If you mean reading table with pandas dataframe, you can use skiprows to skip the first few blank rows, then set the first row as header, below is an example solution.

import pandas as pd

df = pd.read_excel("yourfilepath", skiprows=7)

df.columns = df.iloc[0,:]

# drop the row that use as header

df=df.drop([0],axis=0)

df.head(10)

--

--

KahEm Chu
KahEm Chu

Written by KahEm Chu

Date Science and Analytics Graduate. Passionate in data science, decision science and automating stuff =]

No responses yet