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
0	1    William    C
1	2    Smith     Java
2	3    Parker    Python
3	4    Phill     NaN

Next TopicSet Index




Latest Courses