Comments¶
- There are multiple ways to update the index of a DataFrame or Series.
First,
you can assign a new
SeriesorIndexobject to the index of a DataFrame or Series. Or you can use methods such asDataFrame.set_indexorDataFrame.reset_index.DataFrame.reset_indexresets 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