How to check the excel file for all labels (column label):
That is, for example, if there is no 14th label, the program added it to the column with the value 9999: 
There is a code that unloads these labels; now we need to check against the result file:
import pandas as pd file_name = r'C:\Users\fazliakhmetovRV\Documents\Python Scripts\primer.xlsx' cols = ['label','x','y','z','value'] df = pd.read_excel(file_name, sheetname='er', skiprows=4, header=None, parse_cols='C:XFD') dfs = [] for i in range(df.columns.size//5): lbl_col = 5*i x = df.ix[(df[lbl_col] != 0) & (df[lbl_col] != 9999), lbl_col:lbl_col+4] #x.columns = pd.MultiIndex.from_tuples(list(product([i+1], cols))) x.columns = cols dfs.append(x.reset_index(drop=True,level=1)) result = pd.concat(dfs, axis=1) result.to_excel('result.xlsx', index=False) It is necessary for all df to be checked on the label for the presence of all labels (1,2,3 ... n) (in this case there are 15) (Ie, there may be some labels in the file). And if the program does not find a specific label, then at the place where it should be written a line with this label with the value 9999

