Skip to content

Commit 59c4bff

Browse files
committed
DEPR: deprecate get_ftype_counts (GH18243)
Revert "DOC: update the Index.isin docstring (pandas-dev#20249)" This reverts commit 4a43815.
1 parent 7bab84d commit 59c4bff

File tree

2 files changed

+6
-201615
lines changed

2 files changed

+6
-201615
lines changed

pandas/core/indexes/base.py

+6-60
Original file line numberDiff line numberDiff line change
@@ -3396,11 +3396,8 @@ def map(self, mapper, na_action=None):
33963396

33973397
def isin(self, values, level=None):
33983398
"""
3399-
Return a boolean array where the index values are in `values`.
3400-
34013399
Compute boolean array of whether each index value is found in the
3402-
passed set of values. The length of the returned boolean array matches
3403-
the length of the index.
3400+
passed set of values.
34043401
34053402
Parameters
34063403
----------
@@ -3409,74 +3406,23 @@ def isin(self, values, level=None):
34093406
34103407
.. versionadded:: 0.18.1
34113408
3412-
Support for values as a set.
3409+
Support for values as a set
34133410
34143411
level : str or int, optional
34153412
Name or position of the index level to use (if the index is a
3416-
`MultiIndex`).
3417-
3418-
Returns
3419-
-------
3420-
is_contained : ndarray
3421-
NumPy array of boolean values.
3422-
3423-
See also
3424-
--------
3425-
Series.isin : Same for Series.
3426-
DataFrame.isin : Same method for DataFrames.
3413+
MultiIndex).
34273414
34283415
Notes
34293416
-----
3430-
In the case of `MultiIndex` you must either specify `values` as a
3431-
list-like object containing tuples that are the same length as the
3432-
number of levels, or specify `level`. Otherwise it will raise a
3433-
``ValueError``.
3434-
34353417
If `level` is specified:
34363418
34373419
- if it is the name of one *and only one* index level, use that level;
34383420
- otherwise it should be a number indicating level position.
34393421
3440-
Examples
3441-
--------
3442-
>>> idx = pd.Index([1,2,3])
3443-
>>> idx
3444-
Int64Index([1, 2, 3], dtype='int64')
3445-
3446-
Check whether each index value in a list of values.
3447-
>>> idx.isin([1, 4])
3448-
array([ True, False, False])
3449-
3450-
>>> midx = pd.MultiIndex.from_arrays([[1,2,3],
3451-
... ['red', 'blue', 'green']],
3452-
... names=('number', 'color'))
3453-
>>> midx
3454-
MultiIndex(levels=[[1, 2, 3], ['blue', 'green', 'red']],
3455-
labels=[[0, 1, 2], [2, 0, 1]],
3456-
names=['number', 'color'])
3457-
3458-
Check whether the strings in the 'color' level of the MultiIndex
3459-
are in a list of colors.
3460-
3461-
>>> midx.isin(['red', 'orange', 'yellow'], level='color')
3462-
array([ True, False, False])
3463-
3464-
To check across the levels of a MultiIndex, pass a list of tuples:
3465-
3466-
>>> midx.isin([(1, 'red'), (3, 'red')])
3467-
array([ True, False, False])
3468-
3469-
For a DatetimeIndex, string values in `values` are converted to
3470-
Timestamps.
3471-
3472-
>>> dates = ['2000-03-11', '2000-03-12', '2000-03-13']
3473-
>>> dti = pd.to_datetime(dates)
3474-
>>> dti
3475-
DatetimeIndex(['2000-03-11', '2000-03-12', '2000-03-13'],
3476-
dtype='datetime64[ns]', freq=None)
3422+
Returns
3423+
-------
3424+
is_contained : ndarray (boolean dtype)
34773425
3478-
>>> dti.isin(['2000-03-11'])
3479-
array([ True, False, False])
34803426
"""
34813427
if level is not None:
34823428
self._validate_index_level(level)

0 commit comments

Comments
 (0)