pandas.Index.contains — pandas 0.24.0rc1 documentation (original) (raw)
Return a boolean indicating whether the provided key is in the index.
Parameters: | key : label The key to check if it is present in the index. |
---|---|
Returns: | bool Whether the key search is in the index. |
See also
Returns an ndarray of boolean dtype indicating whether the list-like key is in the index.
Examples
idx = pd.Index([1, 2, 3, 4]) idx Int64Index([1, 2, 3, 4], dtype='int64')
idx.contains(2) True idx.contains(6) False
This is equivalent to:
2 in idx True 6 in idx False