Skip to content

Commit fbfd56d

Browse files
committed
Add an example in the doc-string.
1 parent c7a8274 commit fbfd56d

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
@@ -5651,6 +5651,16 @@ class max_speed
56515651
2 lion mammal 80.5
56525652
3 monkey mammal NaN
56535653
5654+
Using the `names` parameter, it is possible to choose a name for
5655+
the old index column:
5656+
5657+
>>> df.reset_index(names='name')
5658+
name class max_speed
5659+
0 falcon bird 389.0
5660+
1 parrot bird 24.0
5661+
2 lion mammal 80.5
5662+
3 monkey mammal NaN
5663+
56545664
We can use the `drop` parameter to avoid the old index being added as
56555665
a column:
56565666

0 commit comments

Comments
 (0)