From a3e4315899c7b3bbd6fcfc08437e810de1bb32fc Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 1 Oct 2019 18:04:29 -0400 Subject: [PATCH 01/17] DOC: Fixed PR02 docstring error in pandas Series idxmin and idxmax Simple error fixes for idxmin and idxmax regarding their docstrings --- pandas/core/series.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index c87e371354f63..dc41b5f149a0a 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2082,7 +2082,10 @@ def idxmin(self, axis=0, skipna=True, *args, **kwargs): axis : int, default 0 For compatibility with DataFrame.idxmin. Redundant for application on Series. - *args, **kwargs + *args + Additional arguments have no effect but might be accepted + for compatability with NumPy + **kwargs Additional keywords have no effect but might be accepted for compatibility with NumPy. @@ -2152,7 +2155,10 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs): axis : int, default 0 For compatibility with DataFrame.idxmax. Redundant for application on Series. - *args, **kwargs + *args + Additional arguments have no effect but might be accepted + for compatibility with NumPy. + **kwargs Additional keywords have no effect but might be accepted for compatibility with NumPy. From d1f1ba03c964f237e269fbda421d28469a4c27a6 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 1 Oct 2019 18:38:31 -0400 Subject: [PATCH 02/17] DOC: Fixed other PR02 docstring errors in pandas Series class Fixed errors on swaplevel, rename, and drop methods --- pandas/core/series.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index dc41b5f149a0a..63113a9211f76 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3534,8 +3534,10 @@ 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 : int, str + Level of first index to be swapped. Can pass level name as string. + j : int, str + Level of second index to be swapped. Can pass level name as string. copy : bool, default True Whether to copy underlying data. @@ -4089,14 +4091,11 @@ 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 ------- @@ -4166,10 +4165,14 @@ def drop( Index labels to drop. axis : 0, default 0 Redundant for application on Series. - index, columns : None + index : None Redundant for application on Series, but index can be used instead of labels. + .. versionadded:: 0.21.0 + columns : None + Redundant for application on Series. + .. versionadded:: 0.21.0 level : int or level name, optional For MultiIndex, level for which the labels will be removed. From 7fc0e356ecfb4a3f2553253b1e3a0e7d169b2561 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 1 Oct 2019 21:04:15 -0400 Subject: [PATCH 03/17] DOC: Fixed other PR02 docstring errors in pandas rolling and ewm files Fixed methods mean, std, var, and corr in ewm.py. Fixed methods sum, apply, max, std, var, and quantile in rolling.py --- pandas/core/window/ewm.py | 65 ++++++++++++++++++++++------------- pandas/core/window/rolling.py | 23 +++++++++---- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index 40e6c679ba72d..b5b6211723f02 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -17,27 +17,10 @@ ---------- bias : bool, default False Use a standard estimation bias correction. - *args, **kwargs - 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. + *args + Arguments to be passed into func. **kwargs - Keyword arguments to be passed into func. + Keyword arguments to be passed into func. """ @@ -275,8 +258,10 @@ def mean(self, *args, **kwargs): Parameters ---------- - *args, **kwargs - Arguments and keyword arguments to be passed into func. + *args + Arguments to be passed into func. + **kwargs + Keyword arguments to be passed into func. """ nv.validate_window_func("mean", args, kwargs) return self._apply("ewma", **kwargs) @@ -317,10 +302,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 @@ -348,11 +349,27 @@ 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 # only default unset diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 29ef2e917ae57..f8b11b1ef3d8f 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -495,7 +495,10 @@ def aggregate(self, func, *args, **kwargs): Parameters ---------- - *args, **kwargs + *args + For compatibility with other %(name)s methods. Has no effect + on the computed value. + **kwargs For compatibility with other %(name)s methods. Has no effect on the computed value. @@ -1018,7 +1021,9 @@ def count(self): not passed. In the future `raw` will default to False. .. versionadded:: 0.23.0 - *args, **kwargs + args + Arguments and keyword arguments to be passed into func. + kwargs Arguments and keyword arguments to be passed into func. Returns @@ -1084,7 +1089,9 @@ def sum(self, *args, **kwargs): Parameters ---------- - *args, **kwargs + *args + Arguments and keyword arguments to be passed into func. + **kwargs Arguments and keyword arguments to be passed into func. """ ) @@ -1190,7 +1197,9 @@ def median(self, **kwargs): ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``, where ``N`` represents the number of elements. - *args, **kwargs + *args + For NumPy compatibility. No additional arguments are used. + **kwargs For NumPy compatibility. No additional arguments are used. Returns @@ -1265,7 +1274,9 @@ def f(arg, *args, **kwargs): ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``, where ``N`` represents the number of elements. - *args, **kwargs + *args + For NumPy compatibility. No additional arguments are used. + **kwargs For NumPy compatibility. No additional arguments are used. Returns @@ -1392,7 +1403,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. From cd15cec70eee99d4d0d616697cc406efa2d66cd8 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 1 Oct 2019 21:43:07 -0400 Subject: [PATCH 04/17] DOC: Fixed other PR02 docstring errors in pandas plotting file Fixed functions table, scatter_matrix, radviz, bootstrap_plot, parallel_coordinates, lag_plot, and autocorrelation_plot. Noticed that functions with the @deprecate_kwarg decorator tend to not behave correctly with the tests. --- pandas/plotting/_misc.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index a8e86d9dfa997..2a50a8a7dd989 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -15,7 +15,7 @@ def table(ax, data, rowLabels=None, colLabels=None, **kwargs): ax : Matplotlib axes object data : DataFrame or Series data for table contents - kwargs : keywords, optional + **kwargs : keywords, optional keyword arguments which passed to matplotlib.table.table. If `rowLabels` or `colLabels` is not specified, data index or column name will be used. @@ -111,7 +111,7 @@ def scatter_matrix( relative extension of axis range in x and y with respect to (x_max - x_min) or (y_max - y_min), default 0.05 - kwds : other plotting keyword arguments + **kwds : other plotting keyword arguments To be passed to scatter function Returns @@ -170,7 +170,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 : optional Options to pass to matplotlib scatter plotting method. Returns @@ -242,7 +242,7 @@ def andrews_curves( colormap : str or matplotlib colormap object, default None Colormap to select colors from. If string, load colormap with that name from matplotlib. - kwds : keywords + **kwds : keywords Options to pass to matplotlib plotting method Returns @@ -285,7 +285,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 @@ -358,7 +358,7 @@ def parallel_coordinates( .. versionadded:: 0.20.0 - kwds : keywords + **kwds : keywords Options to pass to matplotlib plotting method Returns @@ -401,7 +401,7 @@ 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, optional Returns ------- @@ -419,7 +419,7 @@ def autocorrelation_plot(series, ax=None, **kwds): ---------- series : Time series ax : Matplotlib axis object, optional - kwds : keywords + **kwds : keywords Options to pass to matplotlib plotting method Returns From 51bdc5d7eadae2b767ed0440060e02e61677446b Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 00:10:19 -0400 Subject: [PATCH 05/17] DOC: Fixed other PR02 docstring errors in pandas frame.py file Fixed the docstring for transpose, eval, swaplevel, and melt in frame.py --- pandas/core/frame.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 16f34fee5e1ff..e59c7f5bf568b 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2603,10 +2603,10 @@ 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 + *args + Additional arguments have no effect but might be accepted for + compatibility with numpy. + **kwargs Additional keywords have no effect but might be accepted for compatibility with numpy. @@ -3230,7 +3230,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 : dict See the documentation for :func:`eval` for complete details on the keyword arguments accepted by :meth:`~pandas.DataFrame.query`. @@ -5198,8 +5198,10 @@ 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 : int, str (can be mixed) + Level of first index to be swapped. Can pass level name as string. + j : int, str (can be mixed) + Level of second index to be swapped. Can pass level name as string. Returns ------- @@ -6295,7 +6297,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 From ffe849f1c087956cf56d33a4f536abf2af569514 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 00:22:22 -0400 Subject: [PATCH 06/17] Ran Black Just missed the one line. --- pandas/core/window/ewm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index b5b6211723f02..92815e50f8491 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -369,7 +369,7 @@ def corr(self, other=None, pairwise=None, **kwargs): **kwargs Keyword arguments to be passed into func. """ - + if other is None: other = self._selected_obj # only default unset From f3b954097a6e04721971fad7940559db27193e05 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 00:26:01 -0400 Subject: [PATCH 07/17] Flake8 Changes Caught small whitespace issues. --- pandas/core/series.py | 12 ++++++------ pandas/core/window/ewm.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 63113a9211f76..ab2759be3ba1f 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2082,10 +2082,10 @@ def idxmin(self, axis=0, skipna=True, *args, **kwargs): axis : int, default 0 For compatibility with DataFrame.idxmin. Redundant for application on Series. - *args - Additional arguments have no effect but might be accepted + *args + Additional arguments have no effect but might be accepted for compatability with NumPy - **kwargs + **kwargs Additional keywords have no effect but might be accepted for compatibility with NumPy. @@ -3534,9 +3534,9 @@ def swaplevel(self, i=-2, j=-1, copy=True): Parameters ---------- - i : int, str + i : int, str Level of first index to be swapped. Can pass level name as string. - j : int, str + j : int, str Level of second index to be swapped. Can pass level name as string. copy : bool, default True Whether to copy underlying data. @@ -4165,7 +4165,7 @@ def drop( Index labels to drop. axis : 0, default 0 Redundant for application on Series. - index : None + index : None Redundant for application on Series, but index can be used instead of labels. diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index 92815e50f8491..60a0a398a8651 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -353,7 +353,7 @@ def corr(self, other=None, pairwise=None, **kwargs): """ Exponential weighted sample correlation. - + Parameters ---------- other : Series, DataFrame, or ndarray, optional From bedf748ccce8afd7a4e54bbc589f4440cceb985d Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 10:59:14 -0400 Subject: [PATCH 08/17] Test fixes Fixed errors shown by automated tests (PR04 and GL03) --- pandas/core/series.py | 1 - pandas/core/window/ewm.py | 3 +-- pandas/core/window/rolling.py | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 03c31a8a6e523..865816ab4142d 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4093,7 +4093,6 @@ def rename(self, index=None, **kwargs): Additional keyword arguments passed to the function. Only the "inplace" keyword is used. - Returns ------- Series diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index 60a0a398a8651..0413378d83154 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -353,7 +353,6 @@ def corr(self, other=None, pairwise=None, **kwargs): """ Exponential weighted sample correlation. - Parameters ---------- other : Series, DataFrame, or ndarray, optional @@ -366,7 +365,7 @@ def corr(self, other=None, pairwise=None, **kwargs): 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 + **kwargs : dict of {str : Any} Keyword arguments to be passed into func. """ diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index f8b11b1ef3d8f..23b4095f053ae 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -1021,9 +1021,9 @@ def count(self): not passed. In the future `raw` will default to False. .. versionadded:: 0.23.0 - args + args : tuple of Any Arguments and keyword arguments to be passed into func. - kwargs + kwargs : dict of {str : any} Arguments and keyword arguments to be passed into func. Returns From 4d7a386aacf4132b4b4fee4fb0dca1aaf16b7504 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 11:32:42 -0400 Subject: [PATCH 09/17] DOC: Test fixes part 2 Fixed issues shown by automated tests with error PR03. --- pandas/core/series.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 865816ab4142d..ecd1a8cd6f701 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2076,12 +2076,12 @@ def idxmin(self, axis=0, skipna=True, *args, **kwargs): Parameters ---------- - skipna : bool, default True - Exclude NA/null values. If the entire Series is NA, the result - will be NA. axis : int, default 0 For compatibility with DataFrame.idxmin. Redundant for application on Series. + skipna : bool, default True + Exclude NA/null values. If the entire Series is NA, the result + will be NA. *args Additional arguments have no effect but might be accepted for compatability with NumPy @@ -2149,12 +2149,12 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs): Parameters ---------- - skipna : bool, default True - Exclude NA/null values. If the entire Series is NA, the result - will be NA. axis : int, default 0 For compatibility with DataFrame.idxmax. Redundant for application on Series. + skipna : bool, default True + Exclude NA/null values. If the entire Series is NA, the result + will be NA. *args Additional arguments have no effect but might be accepted for compatibility with NumPy. From 532b53cc800b571fe275a9b4e1d371d021e43e31 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 20:41:32 -0400 Subject: [PATCH 10/17] DOC: Update args and kwargs to same line, other small changes Put args and kwargs back on the same line, since that's how the documentation should be. The validation script needs to be changed to catch this. --- pandas/core/frame.py | 15 ++++++--------- pandas/core/series.py | 20 +++++++------------- pandas/core/window/ewm.py | 9 +++------ pandas/core/window/rolling.py | 21 +++++---------------- pandas/plotting/_misc.py | 3 ++- 5 files changed, 23 insertions(+), 45 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 961f082b2507e..15c6d98be1986 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2610,12 +2610,9 @@ def transpose(self, *args, **kwargs): Parameters ---------- - *args - Additional arguments have no effect but might be accepted for - compatibility with numpy. - **kwargs - Additional keywords have no effect but might be accepted for - compatibility with numpy. + *args, **kwargs + Additional arguments and keywords have no effect but might be + accepted for compatibility with numpy. Returns ------- @@ -3237,7 +3234,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`. @@ -5205,9 +5202,9 @@ def swaplevel(self, i=-2, j=-1, axis=0): Parameters ---------- - i : int, str (can be mixed) + i : int or str Level of first index to be swapped. Can pass level name as string. - j : int, str (can be mixed) + j : int or str Level of second index to be swapped. Can pass level name as string. Returns diff --git a/pandas/core/series.py b/pandas/core/series.py index ecd1a8cd6f701..e1fe8550a7395 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2082,12 +2082,9 @@ def idxmin(self, axis=0, skipna=True, *args, **kwargs): skipna : bool, default True Exclude NA/null values. If the entire Series is NA, the result will be NA. - *args - Additional arguments have no effect but might be accepted - for compatability with NumPy - **kwargs - Additional keywords have no effect but might be accepted - for compatibility with NumPy. + *args, **kwargs + Additional arguments and keywords have no effect but might be + accepted for compatability with NumPy. Returns ------- @@ -2155,13 +2152,10 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs): skipna : bool, default True Exclude NA/null values. If the entire Series is NA, the result will be NA. - *args - Additional arguments have no effect but might be accepted - for compatibility with NumPy. - **kwargs - Additional keywords have no effect but might be accepted - for compatibility with NumPy. - + *args, **kwargs + Additional arguments and keywords have no effect but might be + accepted for compatibility with NumPy. + Returns ------- Index diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index 0413378d83154..242ee0dd5c1b7 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -17,10 +17,8 @@ ---------- bias : bool, default False Use a standard estimation bias correction. - *args - Arguments to be passed into func. - **kwargs - Keyword arguments to be passed into func. + *args, **kwargs + Arguments and keyword arguments to be passed into func. """ @@ -365,10 +363,9 @@ def corr(self, other=None, pairwise=None, **kwargs): 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 : dict of {str : Any} + **kwargs Keyword arguments to be passed into func. """ - if other is None: other = self._selected_obj # only default unset diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 23b4095f053ae..40404f2e644ef 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -495,10 +495,7 @@ def aggregate(self, func, *args, **kwargs): Parameters ---------- - *args - For compatibility with other %(name)s methods. Has no effect - on the computed value. - **kwargs + *args, **kwargs For compatibility with other %(name)s methods. Has no effect on the computed value. @@ -1021,9 +1018,7 @@ def count(self): not passed. In the future `raw` will default to False. .. versionadded:: 0.23.0 - args : tuple of Any - Arguments and keyword arguments to be passed into func. - kwargs : dict of {str : any} + *args, **kwargs Arguments and keyword arguments to be passed into func. Returns @@ -1089,9 +1084,7 @@ def sum(self, *args, **kwargs): Parameters ---------- - *args - Arguments and keyword arguments to be passed into func. - **kwargs + *args, **kwargs Arguments and keyword arguments to be passed into func. """ ) @@ -1197,9 +1190,7 @@ def median(self, **kwargs): ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``, where ``N`` represents the number of elements. - *args - For NumPy compatibility. No additional arguments are used. - **kwargs + *args, **kwargs For NumPy compatibility. No additional arguments are used. Returns @@ -1274,9 +1265,7 @@ def f(arg, *args, **kwargs): ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``, where ``N`` represents the number of elements. - *args - For NumPy compatibility. No additional arguments are used. - **kwargs + *args, **kwargs For NumPy compatibility. No additional arguments are used. Returns diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 7a853267e4952..7e0ee239de929 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -398,7 +398,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, optional Returns ------- From 2df56a26c8c6f79c45bd297b1d209738f93dfaae Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Wed, 2 Oct 2019 20:44:03 -0400 Subject: [PATCH 11/17] DOC: Missed whitespace Should've checked it before commiting. Two very small fixes --- pandas/core/frame.py | 2 +- pandas/core/series.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 41ccb662e0571..541d7a280aeba 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2611,7 +2611,7 @@ def transpose(self, *args, **kwargs): Parameters ---------- *args, **kwargs - Additional arguments and keywords have no effect but might be + Additional arguments and keywords have no effect but might be accepted for compatibility with numpy. Returns diff --git a/pandas/core/series.py b/pandas/core/series.py index 7de52205b2b7f..c6633f9daec27 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2155,7 +2155,7 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs): *args, **kwargs Additional arguments and keywords have no effect but might be accepted for compatibility with NumPy. - + Returns ------- Index From ded2c0c03dc4acc79a94833b41afc274d5f2c844 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Fri, 4 Oct 2019 10:38:59 -0400 Subject: [PATCH 12/17] DOC: Fixing overlooked issues Merged *args and **kwargs, removed a duplicate documentation, and removed the type for **kwargs. --- pandas/core/series.py | 4 ---- pandas/core/window/ewm.py | 4 +--- pandas/plotting/_misc.py | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index c6633f9daec27..8e32e6431ef5a 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4163,10 +4163,6 @@ def drop( columns : single label or list-like No change is made to the Series; use 'index' or 'labels' instead. - .. versionadded:: 0.21.0 - columns : None - Redundant for application on Series. - .. versionadded:: 0.21.0 level : int or level name, optional For MultiIndex, level for which the labels will be removed. diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index 242ee0dd5c1b7..a98e180c03b03 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -256,9 +256,7 @@ def mean(self, *args, **kwargs): Parameters ---------- - *args - Arguments to be passed into func. - **kwargs + *args, **kwargs Keyword arguments to be passed into func. """ nv.validate_window_func("mean", args, kwargs) diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 7e0ee239de929..a2049c40166c3 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -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 From 494b997566ef309104e6f729a59db47c25fe8fb5 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 15 Oct 2019 16:41:58 -0400 Subject: [PATCH 13/17] DOC: Revert back to multiple parameters on one line Moved a couple of index parameters onto the same line, and redid one parameter description --- pandas/core/frame.py | 6 ++---- pandas/core/series.py | 6 ++---- pandas/plotting/_misc.py | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index d898419975e7c..0404244a8bb32 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5206,10 +5206,8 @@ def swaplevel(self, i=-2, j=-1, axis=0): Parameters ---------- - i : int or str - Level of first index to be swapped. Can pass level name as string. - j : int or str - Level of second index to be swapped. Can pass level name as string. + i, j: int or str + Levels indecies to be swapped. Can pass level name as string. Returns ------- diff --git a/pandas/core/series.py b/pandas/core/series.py index 9051a1d18c991..a030b0feebd05 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3525,10 +3525,8 @@ def swaplevel(self, i=-2, j=-1, copy=True): Parameters ---------- - i : int, str - Level of first index to be swapped. Can pass level name as string. - j : int, str - Level of second index to be swapped. Can pass level name as string. + i, j : int, str + Level of the indecies to be swapped. Can pass level name as string. copy : bool, default True Whether to copy underlying data. diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index c38114e69ffb2..a9afeea75014a 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -399,7 +399,7 @@ def lag_plot(series, lag=1, ax=None, **kwds): lag : lag of the scatter plot, default 1 ax : Matplotlib axis object, optional **kwds - Matplotlib scatter method keyword arguments, optional + Matplotlib scatter method keyword arguments. Returns ------- From f631cb485a0623ffcdbce466a0c18479a9b19edc Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 15 Oct 2019 22:10:42 -0400 Subject: [PATCH 14/17] DOC: Spacing fixed Added a space between a parameter and the colon. --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index f2ce6a3204b91..1e23573ad886a 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5206,7 +5206,7 @@ def swaplevel(self, i=-2, j=-1, axis=0): Parameters ---------- - i, j: int or str + i, j : int or str Levels indecies to be swapped. Can pass level name as string. Returns From 16fd88a4f02bd0243930ce93e8927cb785401889 Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Tue, 15 Oct 2019 22:17:48 -0400 Subject: [PATCH 15/17] DOC: Fixed typos Fixed typos on documentation --- pandas/core/frame.py | 2 +- pandas/core/series.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 1e23573ad886a..7abf5a41eaf6f 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5207,7 +5207,7 @@ def swaplevel(self, i=-2, j=-1, axis=0): Parameters ---------- i, j : int or str - Levels indecies to be swapped. Can pass level name as string. + Levels indices to be swapped. Can pass level name as string. Returns ------- diff --git a/pandas/core/series.py b/pandas/core/series.py index 65e916e022125..b31a0eb4bee8f 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3545,7 +3545,7 @@ def swaplevel(self, i=-2, j=-1, copy=True): Parameters ---------- i, j : int, str - Level of the indecies to be swapped. Can pass level name as string. + Level of the indices to be swapped. Can pass level name as string. copy : bool, default True Whether to copy underlying data. From a5cbc8c55c864a6fb161c8c1c561779b9208880c Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Thu, 7 Nov 2019 22:20:19 -0500 Subject: [PATCH 16/17] Update pandas/core/frame.py I didn't know I could do this Co-Authored-By: Marc Garcia --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 7abf5a41eaf6f..eb59684663439 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5207,7 +5207,7 @@ def swaplevel(self, i=-2, j=-1, axis=0): Parameters ---------- i, j : int or str - Levels indices to be swapped. Can pass level name as string. + Levels of the indices to be swapped. Can pass level name as string. Returns ------- From 2a105c26c949236e093d524144a3ab9c3f1ae6bf Mon Sep 17 00:00:00 2001 From: Nathan Abel Date: Thu, 7 Nov 2019 22:21:03 -0500 Subject: [PATCH 17/17] Update pandas/core/window/ewm.py Small change to wording Co-Authored-By: Marc Garcia --- pandas/core/window/ewm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index a98e180c03b03..89c25c07b0dbf 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -257,7 +257,7 @@ def mean(self, *args, **kwargs): Parameters ---------- *args, **kwargs - Keyword arguments to be passed into func. + Arguments and keyword arguments to be passed into func. """ nv.validate_window_func("mean", args, kwargs) return self._apply("ewma", **kwargs)