Skip to content

Commit d96c80e

Browse files
committed
DOC: Improved the docstring of pandas.Series.set_axis
1 parent 4131149 commit d96c80e

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

pandas/core/generic.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -487,24 +487,30 @@ def _expand_axes(self, key):
487487

488488
return new_axes
489489

490-
_shared_docs['set_axis'] = """Assign desired index to given axis
490+
_shared_docs['set_axis'] = """
491+
Assign desired index to given axis.
492+
493+
Indexes for columns or rows can be changed by assigning a list-like or Index.
491494
492495
Parameters
493496
----------
494-
labels: list-like or Index
495-
The values for the new index
496-
axis : int or string, default 0
497+
labels : list-like, Index
498+
The values for the new index.
499+
500+
axis : int, default 0
501+
The value 0 indentify the rows, 1 identify the columns.
502+
497503
inplace : boolean, default None
498504
Whether to return a new %(klass)s instance.
499505
500506
WARNING: inplace=None currently falls back to to True, but
501507
in a future version, will default to False. Use inplace=True
502508
explicitly rather than relying on the default.
503509
504-
.. versionadded:: 0.21.0
505-
The signature is make consistent to the rest of the API.
506-
Previously, the "axis" and "labels" arguments were respectively
507-
the first and second positional arguments.
510+
.. versionadded:: 0.21.0
511+
The signature is make consistent to the rest of the API.
512+
Previously, the "axis" and "labels" arguments were respectively
513+
the first and second positional arguments.
508514
509515
Returns
510516
-------
@@ -513,7 +519,7 @@ def _expand_axes(self, key):
513519
514520
See Also
515521
--------
516-
pandas.NDFrame.rename
522+
pandas.DataFrame.rename_axis : Alter the name of the index or columns.
517523
518524
Examples
519525
--------
@@ -545,7 +551,6 @@ def _expand_axes(self, key):
545551
0 1 4
546552
1 2 5
547553
2 3 6
548-
549554
"""
550555

551556
@Appender(_shared_docs['set_axis'] % dict(klass='NDFrame'))

0 commit comments

Comments
 (0)