|
24 | 24 | from pandas.core.dtypes.concat import concat_compat |
25 | 25 | from pandas.core.dtypes.generic import ABCIndex, ABCSeries |
26 | 26 |
|
27 | | -from pandas.core import algorithms |
28 | 27 | from pandas.core.arrays import DatetimeArray, PeriodArray, TimedeltaArray |
29 | 28 | from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin |
30 | 29 | import pandas.core.common as com |
@@ -500,58 +499,6 @@ def _partial_date_slice( |
500 | 499 | __truediv__ = make_wrapped_arith_op("__truediv__") |
501 | 500 | __rtruediv__ = make_wrapped_arith_op("__rtruediv__") |
502 | 501 |
|
503 | | - def isin(self, values, level=None): |
504 | | - """ |
505 | | - Compute boolean array of whether each index value is found in the |
506 | | - passed set of values. |
507 | | -
|
508 | | - Parameters |
509 | | - ---------- |
510 | | - values : set or sequence of values |
511 | | -
|
512 | | - Returns |
513 | | - ------- |
514 | | - is_contained : ndarray (boolean dtype) |
515 | | - """ |
516 | | - if level is not None: |
517 | | - self._validate_index_level(level) |
518 | | - |
519 | | - if not hasattr(values, "dtype"): |
520 | | - values = np.asarray(values) |
521 | | - |
522 | | - if values.dtype.kind in ["f", "i", "u", "c"]: |
523 | | - # TODO: de-duplicate with equals, validate_comparison_value |
524 | | - return np.zeros(self.shape, dtype=bool) |
525 | | - |
526 | | - if not isinstance(values, type(self)): |
527 | | - inferrable = [ |
528 | | - "timedelta", |
529 | | - "timedelta64", |
530 | | - "datetime", |
531 | | - "datetime64", |
532 | | - "date", |
533 | | - "period", |
534 | | - ] |
535 | | - if values.dtype == object: |
536 | | - inferred = lib.infer_dtype(values, skipna=False) |
537 | | - if inferred not in inferrable: |
538 | | - if "mixed" in inferred: |
539 | | - return self.astype(object).isin(values) |
540 | | - return np.zeros(self.shape, dtype=bool) |
541 | | - |
542 | | - try: |
543 | | - values = type(self)(values) |
544 | | - except ValueError: |
545 | | - return self.astype(object).isin(values) |
546 | | - |
547 | | - try: |
548 | | - self._data._check_compatible_with(values) |
549 | | - except (TypeError, ValueError): |
550 | | - # Includes tzawareness mismatch and IncompatibleFrequencyError |
551 | | - return np.zeros(self.shape, dtype=bool) |
552 | | - |
553 | | - return algorithms.isin(self.asi8, values.asi8) |
554 | | - |
555 | 502 | def shift(self, periods=1, freq=None): |
556 | 503 | """ |
557 | 504 | Shift index by desired number of time frequency increments. |
|
0 commit comments