I have a DataFrame like this
but I want to create DataFrame like this ;
Actually, I just want to append salary up to min, max and mean
CodePudding user response:
Try this
df = df.set_index('department_name')
# add salary as level=0 column name
df.columns = pd.MultiIndex.from_product([['salary'], df.columns])