import pandas as pd df=pd.read_excel('xlwings.xlsx') df.dropna(inplace=True) df.drop(df.loc[df['ID']=='ID'].index,inplace=True) df=pd.pivot(df,index='A',columns='ID',values='A.1')