From 3f007125bc232d7493ff48a9c182d5edf6e32478 Mon Sep 17 00:00:00 2001 From: Will Peppo Date: Wed, 10 Jun 2020 00:37:06 -0400 Subject: [PATCH 1/3] DOC: updated indexes/base.py for SS06 errors --- pandas/core/indexes/base.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 240882e561bc6..1b5555018e1d1 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -609,9 +609,10 @@ def view(self, cls=None): def astype(self, dtype, copy=True): """ - Create an Index with values cast to dtypes. The class of a new Index - is determined by dtype. When conversion is impossible, a ValueError - exception is raised. + Create an Index with values cast to dtypes. + + The class of a new Index is determined by dtype. When conversion is + impossible, a ValueError exception is raised. Parameters ---------- @@ -2197,8 +2198,9 @@ def dropna(self, how="any"): def unique(self, level=None): """ - Return unique values in the index. Uniques are returned in order - of appearance, this does NOT sort. + Return unique values in the index. + + Unique values are returned in order of appearance, this does NOT sort. Parameters ---------- @@ -2675,8 +2677,7 @@ def intersection(self, other, sort=False): def difference(self, other, sort=None): """ - Return a new Index with elements from the index that are not in - `other`. + Return a new Index with elements of index not in `other`. This is the set difference of two Index objects. @@ -3271,8 +3272,7 @@ def _can_reindex(self, indexer): def reindex(self, target, method=None, level=None, limit=None, tolerance=None): """ - Create index with target's values (move/add/delete values - as necessary). + Create index with target's values. Parameters ---------- @@ -4253,8 +4253,7 @@ def equals(self, other: Any) -> bool: def identical(self, other) -> bool: """ - Similar to equals, but check that other comparable attributes are - also equal. + Similar to equals, but checks that object attributes and types are also equal. Returns ------- @@ -4340,8 +4339,7 @@ def asof(self, label): def asof_locs(self, where, mask): """ - Find the locations (indices) of the labels from the index for - every entry in the `where` argument. + Returns the locations (indices) of labels in the index. As in the `asof` function, if the label (a particular entry in `where`) is not in the index, the latest index label up to the @@ -4551,8 +4549,9 @@ def argsort(self, *args, **kwargs) -> np.ndarray: def get_value(self, series: "Series", key): """ - Fast lookup of value from 1-dimensional ndarray. Only use this if you - know what you're doing. + Fast lookup of value from 1-dimensional ndarray. + + Only use this if you know what you're doing. Returns ------- @@ -4905,8 +4904,9 @@ def _get_string_slice(self, key: str_t, use_lhs: bool = True, use_rhs: bool = Tr def slice_indexer(self, start=None, end=None, step=None, kind=None): """ - For an ordered or unique index, compute the slice indexer for input - labels and step. + Compute the slice indexer for input labels and step. + + Index needs to be ordered and unique. Parameters ---------- From 43820f95409137efb3929e191e1e366e6b0de44c Mon Sep 17 00:00:00 2001 From: Will Peppo Date: Thu, 11 Jun 2020 12:53:13 -0400 Subject: [PATCH 2/3] DOC: update docstrings in core/indexes/base.py for SS06 errors --- pandas/core/indexes/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 1b5555018e1d1..b09127f823a79 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4339,7 +4339,7 @@ def asof(self, label): def asof_locs(self, where, mask): """ - Returns the locations (indices) of labels in the index. + Return the locations (indices) of labels in the index. As in the `asof` function, if the label (a particular entry in `where`) is not in the index, the latest index label up to the From ee04e9ed14edff778a7251d06caf248e6df2570b Mon Sep 17 00:00:00 2001 From: Will Peppo Date: Thu, 11 Jun 2020 13:12:06 -0400 Subject: [PATCH 3/3] DOC: updated for whitespaces --- pandas/core/indexes/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index b09127f823a79..4a99d2dfe339a 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -609,7 +609,7 @@ def view(self, cls=None): def astype(self, dtype, copy=True): """ - Create an Index with values cast to dtypes. + Create an Index with values cast to dtypes. The class of a new Index is determined by dtype. When conversion is impossible, a ValueError exception is raised. @@ -2198,7 +2198,7 @@ def dropna(self, how="any"): def unique(self, level=None): """ - Return unique values in the index. + Return unique values in the index. Unique values are returned in order of appearance, this does NOT sort. @@ -4549,7 +4549,7 @@ def argsort(self, *args, **kwargs) -> np.ndarray: def get_value(self, series: "Series", key): """ - Fast lookup of value from 1-dimensional ndarray. + Fast lookup of value from 1-dimensional ndarray. Only use this if you know what you're doing.