Skip to content

Commit 8786e02

Browse files
authored
Document axis for swaplevel, standardize elsewhere (#33016)
1 parent ee017c1 commit 8786e02

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pandas/core/frame.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3897,7 +3897,7 @@ def rename(
38973897
columns : dict-like or function
38983898
Alternative to specifying axis (``mapper, axis=1``
38993899
is equivalent to ``columns=mapper``).
3900-
axis : int or str
3900+
axis : {0 or 'index', 1 or 'columns'}, default 0
39013901
Axis to target with ``mapper``. Can be either the axis name
39023902
('index', 'columns') or number (0, 1). The default is 'index'.
39033903
copy : bool, default True
@@ -5260,6 +5260,9 @@ def swaplevel(self, i=-2, j=-1, axis=0) -> "DataFrame":
52605260
----------
52615261
i, j : int or str
52625262
Levels of the indices to be swapped. Can pass level name as string.
5263+
axis : {0 or 'index', 1 or 'columns'}, default 0
5264+
The axis to swap levels on. 0 or 'index' for row-wise, 1 or
5265+
'columns' for column-wise.
52635266
52645267
Returns
52655268
-------
@@ -5289,7 +5292,7 @@ def reorder_levels(self, order, axis=0) -> "DataFrame":
52895292
order : list of int or list of str
52905293
List representing new level order. Reference level by number
52915294
(position) or by key (label).
5292-
axis : int
5295+
axis : {0 or 'index', 1 or 'columns'}, default 0
52935296
Where to reorder levels.
52945297
52955298
Returns
@@ -7783,7 +7786,7 @@ def count(self, axis=0, level=None, numeric_only=False):
77837786
----------
77847787
axis : {0 or 'index', 1 or 'columns'}, default 0
77857788
If 0 or 'index' counts are generated for each column.
7786-
If 1 or 'columns' counts are generated for each **row**.
7789+
If 1 or 'columns' counts are generated for each row.
77877790
level : int or str, optional
77887791
If the axis is a `MultiIndex` (hierarchical), count along a
77897792
particular `level`, collapsing into a `DataFrame`.
@@ -8341,7 +8344,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, interpolation="linear"):
83418344
----------
83428345
q : float or array-like, default 0.5 (50% quantile)
83438346
Value between 0 <= q <= 1, the quantile(s) to compute.
8344-
axis : {0, 1, 'index', 'columns'} (default 0)
8347+
axis : {0, 1, 'index', 'columns'}, default 0
83458348
Equals 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
83468349
numeric_only : bool, default True
83478350
If False, the quantile of datetime and timedelta data will be

0 commit comments

Comments
 (0)