Skip to content

Commit a115335

Browse files
ChiefMilesEdgeworthMateusz Górski
authored and
Mateusz Górski
committed
Various docstring fixes (pandas-dev#28744)
1 parent 25f7931 commit a115335

File tree

5 files changed

+52
-48
lines changed

5 files changed

+52
-48
lines changed

pandas/core/frame.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -2640,12 +2640,9 @@ def transpose(self, *args, **kwargs):
26402640
26412641
Parameters
26422642
----------
2643-
copy : bool, default False
2644-
If True, the underlying data is copied. Otherwise (default), no
2645-
copy is made if possible.
26462643
*args, **kwargs
2647-
Additional keywords have no effect but might be accepted for
2648-
compatibility with numpy.
2644+
Additional arguments and keywords have no effect but might be
2645+
accepted for compatibility with numpy.
26492646
26502647
Returns
26512648
-------
@@ -3235,7 +3232,7 @@ def eval(self, expr, inplace=False, **kwargs):
32353232
If the expression contains an assignment, whether to perform the
32363233
operation inplace and mutate the existing DataFrame. Otherwise,
32373234
a new DataFrame is returned.
3238-
kwargs : dict
3235+
**kwargs
32393236
See the documentation for :func:`eval` for complete details
32403237
on the keyword arguments accepted by
32413238
:meth:`~pandas.DataFrame.query`.
@@ -5205,8 +5202,8 @@ def swaplevel(self, i=-2, j=-1, axis=0):
52055202
52065203
Parameters
52075204
----------
5208-
i, j : int, str (can be mixed)
5209-
Level of index to be swapped. Can pass level name as string.
5205+
i, j : int or str
5206+
Levels of the indices to be swapped. Can pass level name as string.
52105207
52115208
Returns
52125209
-------
@@ -6296,7 +6293,6 @@ def unstack(self, level=-1, fill_value=None):
62966293
%(versionadded)s
62976294
Parameters
62986295
----------
6299-
frame : DataFrame
63006296
id_vars : tuple, list, or ndarray, optional
63016297
Column(s) to use as identifier variables.
63026298
value_vars : tuple, list, or ndarray, optional

pandas/core/series.py

+10-14
Original file line numberDiff line numberDiff line change
@@ -2093,8 +2093,8 @@ def idxmin(self, axis=0, skipna=True, *args, **kwargs):
20932093
Exclude NA/null values. If the entire Series is NA, the result
20942094
will be NA.
20952095
*args, **kwargs
2096-
Additional keywords have no effect but might be accepted
2097-
for compatibility with NumPy.
2096+
Additional arguments and keywords have no effect but might be
2097+
accepted for compatability with NumPy.
20982098
20992099
Returns
21002100
-------
@@ -2163,8 +2163,8 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs):
21632163
Exclude NA/null values. If the entire Series is NA, the result
21642164
will be NA.
21652165
*args, **kwargs
2166-
Additional keywords have no effect but might be accepted
2167-
for compatibility with NumPy.
2166+
Additional arguments and keywords have no effect but might be
2167+
accepted for compatibility with NumPy.
21682168
21692169
Returns
21702170
-------
@@ -3529,8 +3529,8 @@ def swaplevel(self, i=-2, j=-1, copy=True):
35293529
35303530
Parameters
35313531
----------
3532-
i, j : int, str (can be mixed)
3533-
Level of index to be swapped. Can pass level name as string.
3532+
i, j : int, str
3533+
Level of the indices to be swapped. Can pass level name as string.
35343534
copy : bool, default True
35353535
Whether to copy underlying data.
35363536
@@ -4086,14 +4086,10 @@ def rename(self, index=None, **kwargs):
40864086
the index.
40874087
Scalar or hashable sequence-like will alter the ``Series.name``
40884088
attribute.
4089-
copy : bool, default True
4090-
Whether to copy underlying data.
4091-
inplace : bool, default False
4092-
Whether to return a new Series. If True then value of copy is
4093-
ignored.
4094-
level : int or level name, default None
4095-
In case of a MultiIndex, only rename labels in the specified
4096-
level.
4089+
4090+
**kwargs
4091+
Additional keyword arguments passed to the function. Only the
4092+
"inplace" keyword is used.
40974093
40984094
Returns
40994095
-------

pandas/core/window/ewm.py

+32-21
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,6 @@
2121
Arguments and keyword arguments to be passed into func.
2222
"""
2323

24-
_pairwise_template = """
25-
Parameters
26-
----------
27-
other : Series, DataFrame, or ndarray, optional
28-
If not supplied then will default to self and produce pairwise
29-
output.
30-
pairwise : bool, default None
31-
If False then only matching columns between self and other will be
32-
used and the output will be a DataFrame.
33-
If True then all pairwise combinations will be calculated and the
34-
output will be a MultiIndex DataFrame in the case of DataFrame
35-
inputs. In the case of missing elements, only complete pairwise
36-
observations will be used.
37-
bias : bool, default False
38-
Use a standard estimation bias correction.
39-
**kwargs
40-
Keyword arguments to be passed into func.
41-
"""
42-
4324

4425
class EWM(_Rolling):
4526
r"""
@@ -317,10 +298,26 @@ def f(arg):
317298

318299
@Substitution(name="ewm")
319300
@Appender(_doc_template)
320-
@Appender(_pairwise_template)
321301
def cov(self, other=None, pairwise=None, bias=False, **kwargs):
322302
"""
323303
Exponential weighted sample covariance.
304+
305+
Parameters
306+
----------
307+
other : Series, DataFrame, or ndarray, optional
308+
If not supplied then will default to self and produce pairwise
309+
output.
310+
pairwise : bool, default None
311+
If False then only matching columns between self and other will be
312+
used and the output will be a DataFrame.
313+
If True then all pairwise combinations will be calculated and the
314+
output will be a MultiIndex DataFrame in the case of DataFrame
315+
inputs. In the case of missing elements, only complete pairwise
316+
observations will be used.
317+
bias : bool, default False
318+
Use a standard estimation bias correction
319+
**kwargs
320+
Keyword arguments to be passed into func.
324321
"""
325322
if other is None:
326323
other = self._selected_obj
@@ -348,10 +345,24 @@ def _get_cov(X, Y):
348345

349346
@Substitution(name="ewm")
350347
@Appender(_doc_template)
351-
@Appender(_pairwise_template)
352348
def corr(self, other=None, pairwise=None, **kwargs):
353349
"""
354350
Exponential weighted sample correlation.
351+
352+
Parameters
353+
----------
354+
other : Series, DataFrame, or ndarray, optional
355+
If not supplied then will default to self and produce pairwise
356+
output.
357+
pairwise : bool, default None
358+
If False then only matching columns between self and other will be
359+
used and the output will be a DataFrame.
360+
If True then all pairwise combinations will be calculated and the
361+
output will be a MultiIndex DataFrame in the case of DataFrame
362+
inputs. In the case of missing elements, only complete pairwise
363+
observations will be used.
364+
**kwargs
365+
Keyword arguments to be passed into func.
355366
"""
356367
if other is None:
357368
other = self._selected_obj

pandas/core/window/rolling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ def kurt(self, **kwargs):
14381438
* higher: `j`.
14391439
* nearest: `i` or `j` whichever is nearest.
14401440
* midpoint: (`i` + `j`) / 2.
1441-
**kwargs:
1441+
**kwargs
14421442
For compatibility with other %(name)s methods. Has no effect on
14431443
the result.
14441444

pandas/plotting/_misc.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
168168
colormap : str or :class:`matplotlib.colors.Colormap`, default None
169169
Colormap to select colors from. If string, load colormap with that
170170
name from matplotlib.
171-
kwds : optional
171+
**kwds
172172
Options to pass to matplotlib scatter plotting method.
173173
174174
Returns
@@ -283,7 +283,7 @@ def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
283283
greater or equal than the length of the `series`.
284284
samples : int, default 500
285285
Number of times the bootstrap procedure is performed.
286-
**kwds :
286+
**kwds
287287
Options to pass to matplotlib plotting method.
288288
289289
Returns
@@ -396,7 +396,8 @@ def lag_plot(series, lag=1, ax=None, **kwds):
396396
series : Time series
397397
lag : lag of the scatter plot, default 1
398398
ax : Matplotlib axis object, optional
399-
kwds : Matplotlib scatter method keyword arguments, optional
399+
**kwds
400+
Matplotlib scatter method keyword arguments.
400401
401402
Returns
402403
-------

0 commit comments

Comments
 (0)