Skip to content

Commit ad4465e

Browse files
authored
CLN: remove unused PeriodEngine methods (#33796)
1 parent 3c09d22 commit ad4465e

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

pandas/_libs/index.pyx

+1-34
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ cnp.import_array()
2121

2222
cimport pandas._libs.util as util
2323

24-
from pandas._libs.tslibs import Period
24+
from pandas._libs.tslibs import Period, Timedelta
2525
from pandas._libs.tslibs.nattype cimport c_NaT as NaT
2626
from pandas._libs.tslibs.c_timestamp cimport _Timestamp
2727

2828
from pandas._libs.hashtable cimport HashTable
2929

3030
from pandas._libs import algos, hashtable as _hash
31-
from pandas._libs.tslibs import Timedelta, period as periodlib
3231
from pandas._libs.missing import checknull
3332

3433

@@ -505,38 +504,6 @@ cdef class PeriodEngine(Int64Engine):
505504
cdef _call_monotonic(self, values):
506505
return algos.is_monotonic(values, timelike=True)
507506

508-
def get_indexer(self, values):
509-
cdef:
510-
ndarray[int64_t, ndim=1] ordinals
511-
512-
super(PeriodEngine, self)._ensure_mapping_populated()
513-
514-
freq = super(PeriodEngine, self).vgetter().freq
515-
ordinals = periodlib.extract_ordinals(values, freq)
516-
517-
return self.mapping.lookup(ordinals)
518-
519-
def get_pad_indexer(self, other: np.ndarray, limit=None) -> np.ndarray:
520-
freq = super(PeriodEngine, self).vgetter().freq
521-
ordinal = periodlib.extract_ordinals(other, freq)
522-
523-
return algos.pad(self._get_index_values(),
524-
np.asarray(ordinal), limit=limit)
525-
526-
def get_backfill_indexer(self, other: np.ndarray, limit=None) -> np.ndarray:
527-
freq = super(PeriodEngine, self).vgetter().freq
528-
ordinal = periodlib.extract_ordinals(other, freq)
529-
530-
return algos.backfill(self._get_index_values(),
531-
np.asarray(ordinal), limit=limit)
532-
533-
def get_indexer_non_unique(self, targets):
534-
freq = super(PeriodEngine, self).vgetter().freq
535-
ordinal = periodlib.extract_ordinals(targets, freq)
536-
ordinal_array = np.asarray(ordinal)
537-
538-
return super(PeriodEngine, self).get_indexer_non_unique(ordinal_array)
539-
540507

541508
cdef class BaseMultiIndexCodesEngine:
542509
"""

pandas/core/indexes/period.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from datetime import datetime, timedelta
22
from typing import Any
3-
import weakref
43

54
import numpy as np
65

@@ -322,12 +321,6 @@ def _formatter_func(self):
322321
# ------------------------------------------------------------------------
323322
# Indexing
324323

325-
@cache_readonly
326-
def _engine(self):
327-
# To avoid a reference cycle, pass a weakref of self._values to _engine_type.
328-
period = weakref.ref(self._values)
329-
return self._engine_type(period, len(self))
330-
331324
@doc(Index.__contains__)
332325
def __contains__(self, key: Any) -> bool:
333326
if isinstance(key, Period):

0 commit comments

Comments
 (0)