Skip to content

Commit

Permalink
Various docstring fixes (pandas-dev#28744)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiefMilesEdgeworth authored and proost committed Dec 19, 2019
1 parent 1c0e8dd commit 54859f8
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 48 deletions.
14 changes: 5 additions & 9 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2640,12 +2640,9 @@ def transpose(self, *args, **kwargs):
Parameters
----------
copy : bool, default False
If True, the underlying data is copied. Otherwise (default), no
copy is made if possible.
*args, **kwargs
Additional keywords have no effect but might be accepted for
compatibility with numpy.
Additional arguments and keywords have no effect but might be
accepted for compatibility with numpy.
Returns
-------
Expand Down Expand Up @@ -3235,7 +3232,7 @@ def eval(self, expr, inplace=False, **kwargs):
If the expression contains an assignment, whether to perform the
operation inplace and mutate the existing DataFrame. Otherwise,
a new DataFrame is returned.
kwargs : dict
**kwargs
See the documentation for :func:`eval` for complete details
on the keyword arguments accepted by
:meth:`~pandas.DataFrame.query`.
Expand Down Expand Up @@ -5205,8 +5202,8 @@ def swaplevel(self, i=-2, j=-1, axis=0):
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
i, j : int or str
Levels of the indices to be swapped. Can pass level name as string.
Returns
-------
Expand Down Expand Up @@ -6296,7 +6293,6 @@ def unstack(self, level=-1, fill_value=None):
%(versionadded)s
Parameters
----------
frame : DataFrame
id_vars : tuple, list, or ndarray, optional
Column(s) to use as identifier variables.
value_vars : tuple, list, or ndarray, optional
Expand Down
24 changes: 10 additions & 14 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2093,8 +2093,8 @@ def idxmin(self, axis=0, skipna=True, *args, **kwargs):
Exclude NA/null values. If the entire Series is NA, the result
will be NA.
*args, **kwargs
Additional keywords have no effect but might be accepted
for compatibility with NumPy.
Additional arguments and keywords have no effect but might be
accepted for compatability with NumPy.
Returns
-------
Expand Down Expand Up @@ -2163,8 +2163,8 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs):
Exclude NA/null values. If the entire Series is NA, the result
will be NA.
*args, **kwargs
Additional keywords have no effect but might be accepted
for compatibility with NumPy.
Additional arguments and keywords have no effect but might be
accepted for compatibility with NumPy.
Returns
-------
Expand Down Expand Up @@ -3529,8 +3529,8 @@ def swaplevel(self, i=-2, j=-1, copy=True):
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
i, j : int, str
Level of the indices to be swapped. Can pass level name as string.
copy : bool, default True
Whether to copy underlying data.
Expand Down Expand Up @@ -4086,14 +4086,10 @@ def rename(self, index=None, **kwargs):
the index.
Scalar or hashable sequence-like will alter the ``Series.name``
attribute.
copy : bool, default True
Whether to copy underlying data.
inplace : bool, default False
Whether to return a new Series. If True then value of copy is
ignored.
level : int or level name, default None
In case of a MultiIndex, only rename labels in the specified
level.
**kwargs
Additional keyword arguments passed to the function. Only the
"inplace" keyword is used.
Returns
-------
Expand Down
53 changes: 32 additions & 21 deletions pandas/core/window/ewm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,6 @@
Arguments and keyword arguments to be passed into func.
"""

_pairwise_template = """
Parameters
----------
other : Series, DataFrame, or ndarray, optional
If not supplied then will default to self and produce pairwise
output.
pairwise : bool, default None
If False then only matching columns between self and other will be
used and the output will be a DataFrame.
If True then all pairwise combinations will be calculated and the
output will be a MultiIndex DataFrame in the case of DataFrame
inputs. In the case of missing elements, only complete pairwise
observations will be used.
bias : bool, default False
Use a standard estimation bias correction.
**kwargs
Keyword arguments to be passed into func.
"""


class EWM(_Rolling):
r"""
Expand Down Expand Up @@ -317,10 +298,26 @@ def f(arg):

@Substitution(name="ewm")
@Appender(_doc_template)
@Appender(_pairwise_template)
def cov(self, other=None, pairwise=None, bias=False, **kwargs):
"""
Exponential weighted sample covariance.
Parameters
----------
other : Series, DataFrame, or ndarray, optional
If not supplied then will default to self and produce pairwise
output.
pairwise : bool, default None
If False then only matching columns between self and other will be
used and the output will be a DataFrame.
If True then all pairwise combinations will be calculated and the
output will be a MultiIndex DataFrame in the case of DataFrame
inputs. In the case of missing elements, only complete pairwise
observations will be used.
bias : bool, default False
Use a standard estimation bias correction
**kwargs
Keyword arguments to be passed into func.
"""
if other is None:
other = self._selected_obj
Expand Down Expand Up @@ -348,10 +345,24 @@ def _get_cov(X, Y):

@Substitution(name="ewm")
@Appender(_doc_template)
@Appender(_pairwise_template)
def corr(self, other=None, pairwise=None, **kwargs):
"""
Exponential weighted sample correlation.
Parameters
----------
other : Series, DataFrame, or ndarray, optional
If not supplied then will default to self and produce pairwise
output.
pairwise : bool, default None
If False then only matching columns between self and other will be
used and the output will be a DataFrame.
If True then all pairwise combinations will be calculated and the
output will be a MultiIndex DataFrame in the case of DataFrame
inputs. In the case of missing elements, only complete pairwise
observations will be used.
**kwargs
Keyword arguments to be passed into func.
"""
if other is None:
other = self._selected_obj
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ def kurt(self, **kwargs):
* higher: `j`.
* nearest: `i` or `j` whichever is nearest.
* midpoint: (`i` + `j`) / 2.
**kwargs:
**kwargs
For compatibility with other %(name)s methods. Has no effect on
the result.
Expand Down
7 changes: 4 additions & 3 deletions pandas/plotting/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
colormap : str or :class:`matplotlib.colors.Colormap`, default None
Colormap to select colors from. If string, load colormap with that
name from matplotlib.
kwds : optional
**kwds
Options to pass to matplotlib scatter plotting method.
Returns
Expand Down Expand Up @@ -283,7 +283,7 @@ def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
greater or equal than the length of the `series`.
samples : int, default 500
Number of times the bootstrap procedure is performed.
**kwds :
**kwds
Options to pass to matplotlib plotting method.
Returns
Expand Down Expand Up @@ -396,7 +396,8 @@ def lag_plot(series, lag=1, ax=None, **kwds):
series : Time series
lag : lag of the scatter plot, default 1
ax : Matplotlib axis object, optional
kwds : Matplotlib scatter method keyword arguments, optional
**kwds
Matplotlib scatter method keyword arguments.
Returns
-------
Expand Down

0 comments on commit 54859f8

Please sign in to comment.