@@ -64,6 +64,7 @@ def dt64arr_to_periodarr(data, freq, tz):
6464
6565# --- Period index sketch
6666
67+
6768_DIFFERENT_FREQ_INDEX = period ._DIFFERENT_FREQ_INDEX
6869
6970
@@ -304,7 +305,7 @@ def _simple_new(cls, values, name=None, freq=None, **kwargs):
304305 if (len (values ) > 0 and is_float_dtype (values )):
305306 raise TypeError ("PeriodIndex can't take floats" )
306307 else :
307- return PeriodIndex (values , name = name , freq = freq , ** kwargs )
308+ return cls (values , name = name , freq = freq , ** kwargs )
308309
309310 values = np .array (values , dtype = 'int64' , copy = False )
310311
@@ -325,6 +326,8 @@ def _shallow_copy(self, values=None, **kwargs):
325326 if kwargs .get ('freq' ) is None :
326327 # freq must be provided
327328 kwargs ['freq' ] = self .freq
329+ if values is None :
330+ values = self ._values
328331 return super (PeriodIndex , self )._shallow_copy (values = values , ** kwargs )
329332
330333 def _coerce_scalar_to_index (self , item ):
@@ -355,9 +358,8 @@ def __contains__(self, key):
355358 def asi8 (self ):
356359 return self ._values .view ('i8' )
357360
358- @property
361+ @cache_readonly
359362 def _int64index (self ):
360- # do not cache, same as .asi8
361363 return Int64Index (self .asi8 , name = self .name , fastpath = True )
362364
363365 @property
0 commit comments