Skip to content

Commit aa3f9e7

Browse files
committed
BUG: Change the PeriodIndex engine to PeriodEngine
1 parent 06f087c commit aa3f9e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/core/indexes/period.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import pandas.tseries.offsets as offsets
3232

3333
from pandas._libs.lib import infer_dtype
34-
from pandas._libs import tslib, period
34+
from pandas._libs import tslib, period, index as libindex
3535
from pandas._libs.period import (Period, IncompatibleFrequency,
3636
get_period_field_arr, _validate_end_alias,
3737
_quarter_to_myear)
@@ -192,6 +192,8 @@ class PeriodIndex(DatelikeOps, DatetimeIndexOpsMixin, Int64Index):
192192

193193
freq = None
194194

195+
_engine_type = libindex.PeriodEngine
196+
195197
__eq__ = _period_index_cmp('__eq__')
196198
__ne__ = _period_index_cmp('__ne__', nat_result=True)
197199
__lt__ = _period_index_cmp('__lt__')
@@ -275,6 +277,10 @@ def __new__(cls, data=None, ordinal=None, freq=None, start=None, end=None,
275277
data = period.extract_ordinals(data, freq)
276278
return cls._from_ordinals(data, name=name, freq=freq)
277279

280+
@cache_readonly
281+
def _engine(self):
282+
return self._engine_type(lambda: self, len(self))
283+
278284
@classmethod
279285
def _generate_range(cls, start, end, periods, freq, fields):
280286
if freq is not None:

0 commit comments

Comments
 (0)