Using Boolean Indexing¶
Understand Index in pandas
Comments¶
- There are multiple ways to update the index of a DataFrame or Series.
First,
you can assign a new
Series
orIndex
object to the index of a DataFrame or Series. Or you can use methods such asDataFrame.set_index
orDataFrame.reset_index
.DataFrame.reset_index
resets the index of a DataFrame/Series to an integer index starting from 0. The old index is kept by default but can be dropped using the optiondrop=True
MultiIndexes in pandas
Multi-Index¶
Add level to a MultiIndexes in pandas
Construct MultiIndexes in pandas
Reset the Index of a pandas DataFrame
reset_index¶
By default reset_index
returns a copy rather than modify the original data frame.
You can specify inplace = True
to overwrite the behavior.