considering this DataFrame, I don't know how to have a multi index DataFrame using Pandas :
To fix it you can sort the incidence with sort_index.
df.sort_index(ascending=False, inplace=True)
The final result of the code would be.
df.set_index(['industry', df.index], inplace=True)
df.sort_index(ascending=False, inplace=True)
NOTE: The values used in the dataframe are from examples and do not necessarily coincide with those of your photograph.
CodePudding user response:
Try
df = df.set_index(["industry", "URL article"])