@@ -73,34 +73,30 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
7373 DatetimeLikeArrayMixin ._maybe_mask_results )
7474 __iter__ = ea_passthrough (DatetimeLikeArrayMixin .__iter__ )
7575
76- @property
77- def _eadata (self ):
78- return self ._data
79-
8076 @property
8177 def freq (self ):
8278 """
8379 Return the frequency object if it is set, otherwise None.
8480 """
85- return self ._eadata .freq
81+ return self ._data .freq
8682
8783 @freq .setter
8884 def freq (self , value ):
89- # validation is handled by _eadata setter
90- self ._eadata .freq = value
85+ # validation is handled by _data setter
86+ self ._data .freq = value
9187
9288 @property
9389 def freqstr (self ):
9490 """
9591 Return the frequency object as a string if it is set, otherwise None.
9692 """
97- return self ._eadata .freqstr
93+ return self ._data .freqstr
9894
9995 def unique (self , level = None ):
10096 if level is not None :
10197 self ._validate_index_level (level )
10298
103- result = self ._eadata .unique ()
99+ result = self ._data .unique ()
104100
105101 # Note: if `self` is already unique, then self.unique() should share
106102 # a `freq` with self. If not already unique, then self.freq must be
@@ -113,7 +109,7 @@ def _create_comparison_method(cls, op):
113109 Create a comparison method that dispatches to ``cls.values``.
114110 """
115111 def wrapper (self , other ):
116- result = op (self ._eadata , maybe_unwrap_index (other ))
112+ result = op (self ._data , maybe_unwrap_index (other ))
117113 return result
118114
119115 wrapper .__doc__ = op .__doc__
@@ -122,7 +118,7 @@ def wrapper(self, other):
122118
123119 @property
124120 def _ndarray_values (self ):
125- return self ._eadata ._ndarray_values
121+ return self ._data ._ndarray_values
126122
127123 # ------------------------------------------------------------------------
128124 # Abstract data attributes
@@ -131,12 +127,12 @@ def _ndarray_values(self):
131127 def values (self ):
132128 # type: () -> np.ndarray
133129 # Note: PeriodArray overrides this to return an ndarray of objects.
134- return self ._eadata ._data
130+ return self ._data ._data
135131
136132 @property
137133 @Appender (DatetimeLikeArrayMixin .asi8 .__doc__ )
138134 def asi8 (self ):
139- return self ._eadata .asi8
135+ return self ._data .asi8
140136
141137 # ------------------------------------------------------------------------
142138
@@ -485,7 +481,7 @@ def _add_datetimelike_methods(cls):
485481
486482 def __add__ (self , other ):
487483 # dispatch to ExtensionArray implementation
488- result = self ._eadata .__add__ (maybe_unwrap_index (other ))
484+ result = self ._data .__add__ (maybe_unwrap_index (other ))
489485 return wrap_arithmetic_op (self , other , result )
490486
491487 cls .__add__ = __add__
@@ -497,13 +493,13 @@ def __radd__(self, other):
497493
498494 def __sub__ (self , other ):
499495 # dispatch to ExtensionArray implementation
500- result = self ._eadata .__sub__ (maybe_unwrap_index (other ))
496+ result = self ._data .__sub__ (maybe_unwrap_index (other ))
501497 return wrap_arithmetic_op (self , other , result )
502498
503499 cls .__sub__ = __sub__
504500
505501 def __rsub__ (self , other ):
506- result = self ._eadata .__rsub__ (maybe_unwrap_index (other ))
502+ result = self ._data .__rsub__ (maybe_unwrap_index (other ))
507503 return wrap_arithmetic_op (self , other , result )
508504
509505 cls .__rsub__ = __rsub__
@@ -534,7 +530,6 @@ def repeat(self, repeats, axis=None):
534530 nv .validate_repeat (tuple (), dict (axis = axis ))
535531 freq = self .freq if is_period_dtype (self ) else None
536532 return self ._shallow_copy (self .asi8 .repeat (repeats ), freq = freq )
537- # TODO: dispatch to _eadata
538533
539534 @Appender (_index_shared_docs ['where' ] % _index_doc_kwargs )
540535 def where (self , cond , other = None ):
@@ -599,10 +594,10 @@ def astype(self, dtype, copy=True):
599594 # Ensure that self.astype(self.dtype) is self
600595 return self
601596
602- new_values = self ._eadata .astype (dtype , copy = copy )
597+ new_values = self ._data .astype (dtype , copy = copy )
603598
604599 # pass copy=False because any copying will be done in the
605- # _eadata .astype call above
600+ # _data .astype call above
606601 return Index (new_values ,
607602 dtype = new_values .dtype , name = self .name , copy = False )
608603
@@ -637,7 +632,7 @@ def shift(self, periods, freq=None):
637632 Index.shift : Shift values of Index.
638633 PeriodIndex.shift : Shift values of PeriodIndex.
639634 """
640- result = self ._eadata ._time_shift (periods , freq = freq )
635+ result = self ._data ._time_shift (periods , freq = freq )
641636 return type (self )(result , name = self .name )
642637
643638
@@ -675,9 +670,6 @@ def maybe_unwrap_index(obj):
675670 unwrapped object
676671 """
677672 if isinstance (obj , ABCIndexClass ):
678- if isinstance (obj , DatetimeIndexOpsMixin ):
679- # i.e. PeriodIndex/DatetimeIndex/TimedeltaIndex
680- return obj ._eadata
681673 return obj ._data
682674 return obj
683675
@@ -712,16 +704,16 @@ def _delegate_class(self):
712704 raise AbstractMethodError
713705
714706 def _delegate_property_get (self , name , * args , ** kwargs ):
715- result = getattr (self ._eadata , name )
707+ result = getattr (self ._data , name )
716708 if name not in self ._raw_properties :
717709 result = Index (result , name = self .name )
718710 return result
719711
720712 def _delegate_property_set (self , name , value , * args , ** kwargs ):
721- setattr (self ._eadata , name , value )
713+ setattr (self ._data , name , value )
722714
723715 def _delegate_method (self , name , * args , ** kwargs ):
724- result = operator .methodcaller (name , * args , ** kwargs )(self ._eadata )
716+ result = operator .methodcaller (name , * args , ** kwargs )(self ._data )
725717 if name not in self ._raw_methods :
726718 result = Index (result , name = self .name )
727719 return result
0 commit comments