@@ -65,6 +65,7 @@ def dt64arr_to_periodarr(data, freq, tz):
65
65
66
66
# --- Period index sketch
67
67
68
+
68
69
_DIFFERENT_FREQ_INDEX = period ._DIFFERENT_FREQ_INDEX
69
70
70
71
@@ -305,7 +306,7 @@ def _simple_new(cls, values, name=None, freq=None, **kwargs):
305
306
if (len (values ) > 0 and is_float_dtype (values )):
306
307
raise TypeError ("PeriodIndex can't take floats" )
307
308
else :
308
- return PeriodIndex (values , name = name , freq = freq , ** kwargs )
309
+ return cls (values , name = name , freq = freq , ** kwargs )
309
310
310
311
values = np .array (values , dtype = 'int64' , copy = False )
311
312
@@ -326,6 +327,8 @@ def _shallow_copy(self, values=None, **kwargs):
326
327
if kwargs .get ('freq' ) is None :
327
328
# freq must be provided
328
329
kwargs ['freq' ] = self .freq
330
+ if values is None :
331
+ values = self ._values
329
332
return super (PeriodIndex , self )._shallow_copy (values = values , ** kwargs )
330
333
331
334
def _coerce_scalar_to_index (self , item ):
@@ -356,9 +359,8 @@ def __contains__(self, key):
356
359
def asi8 (self ):
357
360
return self ._values .view ('i8' )
358
361
359
- @property
362
+ @cache_readonly
360
363
def _int64index (self ):
361
- # do not cache, same as .asi8
362
364
return Int64Index (self .asi8 , name = self .name , fastpath = True )
363
365
364
366
@property
0 commit comments