Change the index of a MultiIndexed DataFrame, to a single Index, using a level of the MultiIndex. Other levels
will be dropped if drop_others is set to True
- Parameters:
df (pandas.DataFrame) – dataframe to update
level (str) – name of the index level to use as the new Index
drop_others (bool) – drop all the other levels (as opposed to keeping them in new columns). Default: False.
- Returns:
the data frame with the new index
- Return type:
pandas.DataFrame