Skip to content

Commit ec1c752

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

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

pandas/core/generic.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -487,24 +487,31 @@ 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
494+
a list-like or Index.
491495
492496
Parameters
493497
----------
494-
labels: list-like or Index
495-
The values for the new index
496-
axis : int or string, default 0
498+
labels : list-like, Index
499+
The values for the new index.
500+
501+
axis : {0 or 'index', 1 or 'columns'}, default 0
502+
The value 0 indentify the rows, 1 identify the columns.
503+
497504
inplace : boolean, default None
498505
Whether to return a new %(klass)s instance.
499506
500507
WARNING: inplace=None currently falls back to to True, but
501508
in a future version, will default to False. Use inplace=True
502509
explicitly rather than relying on the default.
503510
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.
511+
.. versionadded:: 0.21.0
512+
The signature is make consistent to the rest of the API.
513+
Previously, the "axis" and "labels" arguments were respectively
514+
the first and second positional arguments.
508515
509516
Returns
510517
-------
@@ -513,7 +520,7 @@ def _expand_axes(self, key):
513520
514521
See Also
515522
--------
516-
pandas.NDFrame.rename
523+
pandas.DataFrame.rename_axis : Alter the name of the index or columns.
517524
518525
Examples
519526
--------
@@ -545,7 +552,6 @@ def _expand_axes(self, key):
545552
0 1 4
546553
1 2 5
547554
2 3 6
548-
549555
"""
550556

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

0 commit comments

Comments
 (0)