Skip to content

Commit ff0a805

Browse files
committed
Updated set_index example
1 parent d053e6c commit ff0a805

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/frame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5958,16 +5958,16 @@ def set_index(
59585958
59595959
Append a column to the existing index:
59605960
5961-
>>> a = df.set_index("month")
5962-
>>> a.set_index("year", append=True)
5961+
>>> df = df.set_index("month")
5962+
>>> df.set_index("year", append=True)
59635963
sale
59645964
month year
59655965
1 2012 55
59665966
4 2014 40
59675967
7 2013 84
59685968
10 2014 31
59695969
5970-
>>> a.set_index("year", append=False)
5970+
>>> df.set_index("year", append=False)
59715971
sale
59725972
year
59735973
2012 55

0 commit comments

Comments
 (0)