Home » Pandas Reset Index

Reset Index

The Reset index of the DataFrame is used to reset the index by using the ‘reset_index‘ command. If the DataFrame has a MultiIndex, this method can remove one or more levels.

Syntax:

Parameters:

level : Refers to int, str, tuple, or list, default value None

It is used to remove the given levels from the index and also removes all levels by default.

drop : Refers to Boolean value, default value False

It resets the index to the default integer index.

inplace : Refers to Boolean value, default value False

It is used to modify the DataFrame in place and does not require to create a new object.

col_level : Refers to int or str, default value 0

It determines level the labels are inserted if the column have multiple labels

col_fill : Refers to an object, default value ”

It determines how the other levels are named if the columns have multiple level.

Example1:

Output:

  index   name    Language  01    William    C  12    Smith     Java  23    Parker    Python  34    Phill     NaN  

Next TopicSet Index

You may also like