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