@@ -2085,7 +2085,7 @@ def _can_hold_element(self, element: Any) -> bool:
2085
2085
return is_integer (element ) or (is_float (element ) and element .is_integer ())
2086
2086
2087
2087
2088
- class DatetimeLikeBlockMixin :
2088
+ class DatetimeLikeBlockMixin ( Block ) :
2089
2089
"""Mixin class for DatetimeBlock, DatetimeTZBlock, and TimedeltaBlock."""
2090
2090
2091
2091
@property
@@ -2123,8 +2123,15 @@ def shift(self, periods, axis=0, fill_value=None):
2123
2123
new_values = values .shift (periods , fill_value = fill_value , axis = axis )
2124
2124
return self .make_block_same_class (new_values )
2125
2125
2126
+ def to_native_types (self , na_rep = "NaT" , ** kwargs ):
2127
+ """ convert to our native types format """
2128
+ arr = self .array_values ()
2129
+
2130
+ result = arr ._format_native_types (na_rep = na_rep , ** kwargs )
2131
+ return self .make_block (result )
2126
2132
2127
- class DatetimeBlock (DatetimeLikeBlockMixin , Block ):
2133
+
2134
+ class DatetimeBlock (DatetimeLikeBlockMixin ):
2128
2135
__slots__ = ()
2129
2136
is_datetime = True
2130
2137
@@ -2204,15 +2211,6 @@ def _can_hold_element(self, element: Any) -> bool:
2204
2211
2205
2212
return is_valid_nat_for_dtype (element , self .dtype )
2206
2213
2207
- def to_native_types (self , na_rep = "NaT" , date_format = None , ** kwargs ):
2208
- """ convert to our native types format """
2209
- dta = self .array_values ()
2210
-
2211
- result = dta ._format_native_types (
2212
- na_rep = na_rep , date_format = date_format , ** kwargs
2213
- )
2214
- return self .make_block (result )
2215
-
2216
2214
def set (self , locs , values ):
2217
2215
"""
2218
2216
See Block.set.__doc__
@@ -2412,12 +2410,6 @@ def fillna(self, value, **kwargs):
2412
2410
)
2413
2411
return super ().fillna (value , ** kwargs )
2414
2412
2415
- def to_native_types (self , na_rep = "NaT" , ** kwargs ):
2416
- """ convert to our native types format """
2417
- tda = self .array_values ()
2418
- res = tda ._format_native_types (na_rep , ** kwargs )
2419
- return self .make_block (res )
2420
-
2421
2413
2422
2414
class BoolBlock (NumericBlock ):
2423
2415
__slots__ = ()
0 commit comments