From 10028e09ecc45bd224bc2911feca7dcb01bb4784 Mon Sep 17 00:00:00 2001 From: Sasikanth Kotti Date: Mon, 8 Oct 2018 12:25:10 +0530 Subject: [PATCH 1/2] Updated as suggested in the comments of PR#20211 --- pandas/core/indexes/base.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 51c84d6e28cb4..86b4fb580f263 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2005,15 +2005,29 @@ def __contains__(self, key): return False _index_shared_docs['contains'] = """ - return a boolean if this key is IN the index + Return a boolean if this key is in the index. + Parameters ---------- key : object + key to be searched. Returns ------- boolean + result of the search. + + See Also + -------- + Index.isin + + Examples + -------- + >>> pd.CategoricalIndex([2000, 2001, 2012]).contains(2001) + True + >>> pd.CategoricalIndex([2000, 2001, 2012]).contains(2222) + False """ @Appender(_index_shared_docs['contains'] % _index_doc_kwargs) From 51f853956302c98ffa7f78ddfbf3d5a3c5b5ddab Mon Sep 17 00:00:00 2001 From: Sasikanth Kotti Date: Mon, 8 Oct 2018 14:24:42 +0530 Subject: [PATCH 2/2] Fixed PEP8 issues --- pandas/core/indexes/base.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 86b4fb580f263..61f3325e3dceb 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2011,23 +2011,23 @@ def __contains__(self, key): Parameters ---------- key : object - key to be searched. + key to be searched. Returns ------- boolean - result of the search. - - See Also - -------- - Index.isin - - Examples - -------- - >>> pd.CategoricalIndex([2000, 2001, 2012]).contains(2001) - True - >>> pd.CategoricalIndex([2000, 2001, 2012]).contains(2222) - False + result of the search. + + See Also + -------- + Index.isin + + Examples + -------- + >>> pd.CategoricalIndex([2000, 2001, 2012]).contains(2001) + True + >>> pd.CategoricalIndex([2000, 2001, 2012]).contains(2222) + False """ @Appender(_index_shared_docs['contains'] % _index_doc_kwargs)