diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 888507a529687..85fbde799dae7 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1832,15 +1832,31 @@ def __contains__(self, key): return False _index_shared_docs['contains'] = """ - return a boolean if this key is IN the index + Return a boolean if key is in the index. + + This function returns True if key is in the index and + returns False if key is not in index. Parameters ---------- - key : object + key : immutable object + Key to be searched. Returns ------- - boolean + bool + Result of the key search. + + Notes + ----- + CategoricalIndex is a sub-class of Index. + + 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)