diff --git a/ci/code_checks.sh b/ci/code_checks.sh index c4840f1e836c4..51df779341ed5 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -241,8 +241,8 @@ fi ### DOCSTRINGS ### if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then - MSG='Validate docstrings (GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT04, RT05, SA05)' ; echo $MSG - $BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT04,RT05,SA05 + MSG='Validate docstrings (GL03, GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT04, RT05, SA05)' ; echo $MSG + $BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT04,RT05,SA05 RET=$(($RET + $?)) ; echo $MSG "DONE" fi diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 6e40063fb925a..37aa05659b70f 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1156,7 +1156,6 @@ class Timedelta(_Timedelta): Notes ----- The ``.value`` attribute is always in ns. - """ def __new__(cls, object value=_no_input, unit=None, **kwargs): cdef _Timedelta td_base diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 75cf658423210..89f2b9961a4d7 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -119,7 +119,7 @@ def f(self): return result f.__name__ = name - f.__doc__ = "\n{}\n".format(docstring) + f.__doc__ = docstring return property(f) diff --git a/pandas/core/arrays/sparse.py b/pandas/core/arrays/sparse.py index 9be2c9af169e8..fd7149edc8d7c 100644 --- a/pandas/core/arrays/sparse.py +++ b/pandas/core/arrays/sparse.py @@ -541,7 +541,6 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin): 3. ``data.dtype.fill_value`` if `fill_value` is None and `dtype` is not a ``SparseDtype`` and `data` is a ``SparseArray``. - kind : {'integer', 'block'}, default 'integer' The type of storage for sparse locations. diff --git a/pandas/core/base.py b/pandas/core/base.py index f896596dd5216..c0f3df1b36c03 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -870,7 +870,6 @@ def to_numpy(self, dtype=None, copy=False): .. versionadded:: 0.24.0 - Parameters ---------- dtype : str or numpy.dtype, optional diff --git a/pandas/core/config.py b/pandas/core/config.py index 01664fffb1e27..b6264a5257dcb 100644 --- a/pandas/core/config.py +++ b/pandas/core/config.py @@ -651,7 +651,6 @@ def _build_option_description(k): .format(rkey=d.rkey if d.rkey else '')) s += u(')') - s += '\n\n' return s diff --git a/pandas/core/frame.py b/pandas/core/frame.py index eadffb779734f..3996728a1cc90 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2184,7 +2184,6 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True, Convert URLs to HTML links. .. versionadded:: 0.24.0 - %(returns)s See Also -------- @@ -6027,7 +6026,6 @@ def unstack(self, level=-1, fill_value=None): columns, considered measured variables (`value_vars`), are "unpivoted" to the row axis, leaving just two non-identifier columns, 'variable' and 'value'. - %(versionadded)s Parameters ---------- diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 0b81576404e2f..d2b87d79c7d52 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -948,7 +948,6 @@ def swaplevel(self, i=-2, j=-1, axis=0): The indexes ``i`` and ``j`` are now optional, and default to the two innermost levels of the index. - """ axis = self._get_axis_number(axis) result = self.copy() @@ -4951,9 +4950,7 @@ def pipe(self, func, *args, **kwargs): _shared_docs['aggregate'] = dedent(""" Aggregate using one or more operations over the specified axis. - %(versionadded)s - Parameters ---------- func : function, str, list or dict @@ -4983,17 +4980,13 @@ def pipe(self, func, *args, **kwargs): * DataFrame : when DataFrame.agg is called with several functions Return scalar, Series or DataFrame. - %(see_also)s - Notes ----- `agg` is an alias for `aggregate`. Use the alias. A passed user-defined-function will be passed a Series for evaluation. - - %(examples)s - """) + %(examples)s""") _shared_docs['transform'] = (""" Call ``func`` on self producing a %(klass)s with transformed values @@ -10307,7 +10300,7 @@ def _doc_parms(cls): Returns ------- -%(name1)s or %(name2)s (if level specified) +%(name1)s or %(name2)s (if level specified)\ %(see_also)s %(examples)s\ """ @@ -10464,8 +10457,7 @@ def _doc_parms(cls): %(name2)s.cumsum : Return cumulative sum over %(name2)s axis. %(name2)s.cumprod : Return cumulative product over %(name2)s axis. -%(examples)s -""" +%(examples)s""" _cummin_examples = """\ Examples diff --git a/pandas/core/groupby/base.py b/pandas/core/groupby/base.py index ebba4a0a9395d..903c898b68873 100644 --- a/pandas/core/groupby/base.py +++ b/pandas/core/groupby/base.py @@ -126,9 +126,7 @@ class where members are defined. property_wrapper_template = \ """@property def %(name)s(self) : - \""" - %(doc)s - \""" + \"""%(doc)s\""" return self.__getattr__('%(name)s')""" for name in whitelist: diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 36dcb692bb079..3d0a6023ac29f 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -221,8 +221,7 @@ class providing the base-class of operations. Examples -------- -%(examples)s -""" +%(examples)s""" _transform_template = """ Call function producing a like-indexed %(klass)s on each group and @@ -1106,9 +1105,7 @@ def mean(self, *args, **kwargs): Returns ------- pandas.Series or pandas.DataFrame - %(see_also)s - Examples -------- >>> df = pd.DataFrame({'A': [1, 1, 2, 1, 2], @@ -1564,9 +1561,7 @@ def nth(self, n, dropna=None): dropna : None or str, optional apply the specified dropna operation before counting which row is the nth row. Needs to be None, 'any' or 'all' - %(see_also)s - Examples -------- @@ -2139,9 +2134,7 @@ def head(self, n=5): Essentially equivalent to ``.apply(lambda x: x.head(n))``, except ignores as_index flag. - %(see_also)s - Examples -------- @@ -2167,9 +2160,7 @@ def tail(self, n=5): Essentially equivalent to ``.apply(lambda x: x.tail(n))``, except ignores as_index flag. - %(see_also)s - Examples -------- diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index dee181fc1c569..29b9a47a92a48 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3104,7 +3104,6 @@ def reindex(self, target, method=None, level=None, limit=None, Resulting index. indexer : np.ndarray or None Indices of output values in original index. - """ # GH6552: preserve names when reindexing to non-named target # (i.e. neither Index nor Series). diff --git a/pandas/io/feather_format.py b/pandas/io/feather_format.py index d76e6b75d3762..b2c6dff4338b6 100644 --- a/pandas/io/feather_format.py +++ b/pandas/io/feather_format.py @@ -110,7 +110,6 @@ def read_feather(path, columns=None, use_threads=True): Returns ------- type of object stored in file - """ feather, pyarrow = _try_import() diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 5171ea68fd497..b8073c89892c5 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -303,7 +303,6 @@ def andrews_curves(frame, class_column, ax=None, samples=200, color=None, Returns ------- class:`matplotlip.axis.Axes` - """ from math import sqrt, pi import matplotlib.pyplot as plt