From bbc767e7ad17fb59cb21d2fa745f5e1aeff31fe7 Mon Sep 17 00:00:00 2001 From: Zach Angell <42625717+zangell44@users.noreply.github.com> Date: Thu, 14 Feb 2019 14:18:05 -0500 Subject: [PATCH] Rt05 documentation error fix issue 25108 (#25309) --- ci/code_checks.sh | 4 ++-- pandas/core/algorithms.py | 2 +- pandas/core/arrays/categorical.py | 2 +- pandas/core/arrays/datetimelike.py | 2 +- pandas/core/frame.py | 2 +- pandas/core/generic.py | 18 +++++++++--------- pandas/core/indexes/base.py | 10 +++++----- pandas/core/indexes/multi.py | 6 +++--- pandas/core/panel.py | 6 +++--- pandas/core/reshape/melt.py | 2 +- pandas/core/series.py | 24 ++++++++++++++---------- pandas/core/tools/numeric.py | 2 +- pandas/core/window.py | 2 +- pandas/io/formats/style.py | 2 +- pandas/plotting/_core.py | 21 +++++++++++---------- pandas/plotting/_misc.py | 2 +- pandas/tseries/frequencies.py | 2 +- 17 files changed, 57 insertions(+), 52 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index eacab199cc0bea..ac6aade106ce60 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, PR03, PR05, PR10, EX04, RT04, SS05, SA05)' ; echo $MSG - $BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR04,PR05,EX04,RT04,SS05,SA05 + MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, PR10, EX04, RT04, RT05, SS05, SA05)' ; echo $MSG + $BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR04,PR05,EX04,RT04,RT05,SS05,SA05 RET=$(($RET + $?)) ; echo $MSG "DONE" fi diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 77681f6ac3f937..c5c8f47ad6dba2 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -291,7 +291,7 @@ def unique(values): unique values. If the input is an Index, the return is an Index If the input is a Categorical dtype, the return is a Categorical - If the input is a Series/ndarray, the return will be an ndarray + If the input is a Series/ndarray, the return will be an ndarray. See Also -------- diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index ab58f86e0a6bcd..d7d0882bbcc942 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1292,7 +1292,7 @@ def __array__(self, dtype=None): values : numpy array A numpy array of either the specified dtype or, if dtype==None (default), the same dtype as - categorical.categories.dtype + categorical.categories.dtype. """ ret = take_1d(self.categories.values, self._codes) if dtype and not is_dtype_equal(dtype, self.categories.dtype): diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 73e799f9e0a36e..84536ac72a4554 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -154,7 +154,7 @@ def strftime(self, date_format): Returns ------- Index - Index of formatted strings + Index of formatted strings. See Also -------- diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 7ac18b79daba10..cf97c94f6d1297 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2743,7 +2743,7 @@ def set_value(self, index, col, value, takeable=False): ------- DataFrame If label pair is contained, will be reference to calling DataFrame, - otherwise a new object + otherwise a new object. """ warnings.warn("set_value is deprecated and will be removed " "in a future release. Please use " diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 1a404630b660ef..e2308836d982a5 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4953,7 +4953,7 @@ def pipe(self, func, *args, **kwargs): If DataFrame.agg is called with a single function, returns a Series If DataFrame.agg is called with several functions, returns a DataFrame If Series.agg is called with single function, returns a scalar - If Series.agg is called with several functions, returns a Series + If Series.agg is called with several functions, returns a Series. %(see_also)s @@ -5349,7 +5349,7 @@ def get_values(self): Returns ------- numpy.ndarray - Numpy representation of DataFrame + Numpy representation of DataFrame. See Also -------- @@ -5428,7 +5428,7 @@ def get_ftype_counts(self): ------- dtype : Series Series with the count of columns with each type and - sparsity (dense/sparse) + sparsity (dense/sparse). See Also -------- @@ -6657,7 +6657,7 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None, ------- Series or DataFrame Returns the same object type as the caller, interpolated at - some or all ``NaN`` values + some or all ``NaN`` values. See Also -------- @@ -6877,11 +6877,11 @@ def asof(self, where, subset=None): ------- scalar, Series, or DataFrame - Scalar : when `self` is a Series and `where` is a scalar + Scalar : when `self` is a Series and `where` is a scalar. Series: when `self` is a Series and `where` is an array-like, - or when `self` is a DataFrame and `where` is a scalar + or when `self` is a DataFrame and `where` is a scalar. DataFrame : when `self` is a DataFrame and `where` is an - array-like + array-like. See Also -------- @@ -7235,7 +7235,7 @@ def clip(self, lower=None, upper=None, axis=None, inplace=False, ------- Series or DataFrame Same type as calling object with the values outside the - clip boundaries replaced + clip boundaries replaced. Examples -------- @@ -8386,7 +8386,7 @@ def ranker(data): Returns ------- (left, right) : (%(klass)s, type of other) - Aligned objects + Aligned objects. """) @Appender(_shared_docs['align'] % _shared_doc_kwargs) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index cf813f4c3030ba..f2c8ac6e9b413a 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1828,7 +1828,7 @@ def isna(self): Returns ------- numpy.ndarray - A boolean array of whether my values are NA + A boolean array of whether my values are NA. See Also -------- @@ -3098,9 +3098,9 @@ def reindex(self, target, method=None, level=None, limit=None, Returns ------- new_index : pd.Index - Resulting index + Resulting index. indexer : np.ndarray or None - Indices of output values in original index + Indices of output values in original index. """ # GH6552: preserve names when reindexing to non-named target @@ -4259,7 +4259,7 @@ def shift(self, periods=1, freq=None): Returns ------- pandas.Index - Shifted index + Shifted index. See Also -------- @@ -4422,7 +4422,7 @@ def set_value(self, arr, key, value): in the target are marked by -1. missing : ndarray of int An indexer into the target of the values not found. - These correspond to the -1 in the indexer array + These correspond to the -1 in the indexer array. """ @Appender(_index_shared_docs['get_indexer_non_unique'] % _index_doc_kwargs) diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index e2237afbcac0fb..efb77b5d155a1b 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1956,7 +1956,7 @@ def swaplevel(self, i=-2, j=-1): Returns ------- MultiIndex - A new MultiIndex + A new MultiIndex. .. versionchanged:: 0.18.1 @@ -2053,9 +2053,9 @@ def sortlevel(self, level=0, ascending=True, sort_remaining=True): Returns ------- sorted_index : pd.MultiIndex - Resulting index + Resulting index. indexer : np.ndarray - Indices of output values in original index + Indices of output values in original index. """ from pandas.core.sorting import indexer_from_factorized diff --git a/pandas/core/panel.py b/pandas/core/panel.py index dda5533f1ea7b7..1555542079d800 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -540,7 +540,7 @@ def set_value(self, *args, **kwargs): ------- panel : Panel If label combo is contained, will be reference to calling Panel, - otherwise a new object + otherwise a new object. """ warnings.warn("set_value is deprecated and will be removed " "in a future release. Please use " @@ -803,7 +803,7 @@ def major_xs(self, key): Returns ------- y : DataFrame - Index -> minor axis, columns -> items + Index -> minor axis, columns -> items. Notes ----- @@ -827,7 +827,7 @@ def minor_xs(self, key): Returns ------- y : DataFrame - Index -> major axis, columns -> items + Index -> major axis, columns -> items. Notes ----- diff --git a/pandas/core/reshape/melt.py b/pandas/core/reshape/melt.py index 312a108ad33805..0fa80de812c5fa 100644 --- a/pandas/core/reshape/melt.py +++ b/pandas/core/reshape/melt.py @@ -230,7 +230,7 @@ def wide_to_long(df, stubnames, i, j, sep="", suffix=r'\d+'): ------- DataFrame A DataFrame that contains each stub name as a variable, with new index - (i, j) + (i, j). Notes ----- diff --git a/pandas/core/series.py b/pandas/core/series.py index b2011fdcdee981..31c62474364181 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1215,7 +1215,7 @@ def set_value(self, label, value, takeable=False): ------- Series If label is contained, will be reference to calling Series, - otherwise a new object + otherwise a new object. """ warnings.warn("set_value is deprecated and will be removed " "in a future release. Please use " @@ -1648,10 +1648,19 @@ def unique(self): Returns ------- ndarray or ExtensionArray - The unique values returned as a NumPy array. In case of an - extension-array backed Series, a new - :class:`~api.extensions.ExtensionArray` of that type with just - the unique values is returned. This includes + The unique values returned as a NumPy array. See Notes. + + See Also + -------- + unique : Top-level unique method for any 1-d array-like object. + Index.unique : Return Index with unique values from an Index object. + + Notes + ----- + Returns the unique values as a NumPy array. In case of an + extension-array backed Series, a new + :class:`~api.extensions.ExtensionArray` of that type with just + the unique values is returned. This includes * Categorical * Period @@ -1660,11 +1669,6 @@ def unique(self): * Sparse * IntegerNA - See Also - -------- - unique : Top-level unique method for any 1-d array-like object. - Index.unique : Return Index with unique values from an Index object. - Examples -------- >>> pd.Series([2, 1, 3, 3], name='A').unique() diff --git a/pandas/core/tools/numeric.py b/pandas/core/tools/numeric.py index b8a7eb5b0c570b..08ce649d8602ce 100644 --- a/pandas/core/tools/numeric.py +++ b/pandas/core/tools/numeric.py @@ -59,7 +59,7 @@ def to_numeric(arg, errors='raise', downcast=None): Returns ------- ret : numeric if parsing succeeded. - Return type depends on input. Series if Series, otherwise ndarray + Return type depends on input. Series if Series, otherwise ndarray. See Also -------- diff --git a/pandas/core/window.py b/pandas/core/window.py index fb37d790f950ca..9e29fdb94c1e01 100644 --- a/pandas/core/window.py +++ b/pandas/core/window.py @@ -1271,7 +1271,7 @@ def skew(self, **kwargs): ------- Series or DataFrame Returned object type is determined by the caller of the %(name)s - calculation + calculation. See Also -------- diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index cd6e3505d71db1..c8b5dc6b9b7c0b 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -435,7 +435,7 @@ def render(self, **kwargs): Returns ------- rendered : str - The rendered HTML + The rendered HTML. Notes ----- diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index a525b9cff1182e..2c672f235f1e16 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -2050,9 +2050,17 @@ def plot_series(data, kind='line', ax=None, # Series unique Returns ------- - result : + result + See Notes. - The return type depends on the `return_type` parameter: + See Also + -------- + Series.plot.hist: Make a histogram. + matplotlib.pyplot.boxplot : Matplotlib equivalent plot. + + Notes + ----- + The return type depends on the `return_type` parameter: * 'axes' : object of class matplotlib.axes.Axes * 'dict' : dict of matplotlib.lines.Line2D objects @@ -2063,13 +2071,6 @@ def plot_series(data, kind='line', ax=None, # Series unique * :class:`~pandas.Series` * :class:`~numpy.array` (for ``return_type = None``) - See Also - -------- - Series.plot.hist: Make a histogram. - matplotlib.pyplot.boxplot : Matplotlib equivalent plot. - - Notes - ----- Use ``return_type='dict'`` when you want to tweak the appearance of the lines after plotting. In this case a dict containing the Lines making up the boxes, caps, fliers, medians, and whiskers is returned. @@ -3332,7 +3333,7 @@ def area(self, x=None, y=None, **kwds): Returns ------- matplotlib.axes.Axes or numpy.ndarray - Area plot, or array of area plots if subplots is True + Area plot, or array of area plots if subplots is True. See Also -------- diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 62a33245f99efc..21592a5b4a0a18 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -390,7 +390,7 @@ def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds): Returns ------- fig : matplotlib.figure.Figure - Matplotlib figure + Matplotlib figure. See Also -------- diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py index f591b24f5b6480..4802447cbc99d3 100644 --- a/pandas/tseries/frequencies.py +++ b/pandas/tseries/frequencies.py @@ -68,7 +68,7 @@ def to_offset(freq): Returns ------- delta : DateOffset - None if freq is None + None if freq is None. Raises ------