Skip to content

DOC: Document axis for swaplevel, standardize elsewhere #33016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3897,7 +3897,7 @@ def rename(
columns : dict-like or function
Alternative to specifying axis (``mapper, axis=1``
is equivalent to ``columns=mapper``).
axis : int or str
axis : {0 or 'index', 1 or 'columns'}, default 0
Axis to target with ``mapper``. Can be either the axis name
('index', 'columns') or number (0, 1). The default is 'index'.
copy : bool, default True
Expand Down Expand Up @@ -5260,6 +5260,9 @@ def swaplevel(self, i=-2, j=-1, axis=0) -> "DataFrame":
----------
i, j : int or str
Levels of the indices to be swapped. Can pass level name as string.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to swap levels on. 0 or 'index' for row-wise, 1 or
'columns' for column-wise.

Returns
-------
Expand Down Expand Up @@ -5289,7 +5292,7 @@ def reorder_levels(self, order, axis=0) -> "DataFrame":
order : list of int or list of str
List representing new level order. Reference level by number
(position) or by key (label).
axis : int
axis : {0 or 'index', 1 or 'columns'}, default 0
Where to reorder levels.

Returns
Expand Down Expand Up @@ -7783,7 +7786,7 @@ def count(self, axis=0, level=None, numeric_only=False):
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
If 0 or 'index' counts are generated for each column.
If 1 or 'columns' counts are generated for each **row**.
If 1 or 'columns' counts are generated for each row.
level : int or str, optional
If the axis is a `MultiIndex` (hierarchical), count along a
particular `level`, collapsing into a `DataFrame`.
Expand Down Expand Up @@ -8341,7 +8344,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, interpolation="linear"):
----------
q : float or array-like, default 0.5 (50% quantile)
Value between 0 <= q <= 1, the quantile(s) to compute.
axis : {0, 1, 'index', 'columns'} (default 0)
axis : {0, 1, 'index', 'columns'}, default 0
Equals 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
numeric_only : bool, default True
If False, the quantile of datetime and timedelta data will be
Expand Down