human
Python Pandas - How to flatten a hierarchical index in columns
assistant
Here is some code to collapse hierarchical column index to level 0 in dataframe `df`

df.columns = df.columns.get_level_values(0)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.