df.rename(columns=df.iloc[0]).drop(df.index[0])
# best practice is to use the `header=None` parameter
# this way, the initial header will turn into the first row in the dataframe
df = pd.read_csv(file, header=None)
df, df.columns = df[1:] , df.iloc[0]
df = df.T.set_index(0).T
df.columns = df.iloc[0]
df = df[1:]
df.head()
see the difference between these two lines
#no header
data= pd.read_csv(path, header = None, delim_whitespace=True, error_bad_lines=False)
#with headers
data= pd.read_csv(path, delim_whitespace=True, error_bad_lines=False)