Skip to content

Commit ecf88ff

Browse files
committed
Add an example in the doc-string.
1 parent ab57232 commit ecf88ff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/core/frame.py

+10
Original file line numberDiff line numberDiff line change
@@ -5676,6 +5676,16 @@ class max_speed
56765676
2 lion mammal 80.5
56775677
3 monkey mammal NaN
56785678
5679+
Using the `names` parameter, it is possible to choose a name for
5680+
the old index column:
5681+
5682+
>>> df.reset_index(names='name')
5683+
name class max_speed
5684+
0 falcon bird 389.0
5685+
1 parrot bird 24.0
5686+
2 lion mammal 80.5
5687+
3 monkey mammal NaN
5688+
56795689
We can use the `drop` parameter to avoid the old index being added as
56805690
a column:
56815691

0 commit comments

Comments
 (0)