@@ -149,8 +149,7 @@ class DatelikeOps(object):
149
149
150
150
def strftime (self , date_format ):
151
151
from pandas import Index
152
- return Index (self .format (date_format = date_format ),
153
- dtype = compat .text_type )
152
+ return Index (self ._format_native_types (date_format = date_format ))
154
153
strftime .__doc__ = """
155
154
Convert to Index using specified date_format.
156
155
@@ -401,7 +400,7 @@ def _ndarray_values(self):
401
400
# ------------------------------------------------------------------
402
401
# Formatting
403
402
404
- def _format_native_types (self ):
403
+ def _format_native_types (self , na_rep = u'NaT' , date_format = None ):
405
404
"""
406
405
Helper method for astype when converting to strings.
407
406
@@ -414,9 +413,6 @@ def _format_native_types(self):
414
413
def _formatter (self , boxed = False ):
415
414
return "'{}'" .format
416
415
417
- def strftime (self , date_format ):
418
- return self ._format_native_types (date_format = date_format )
419
-
420
416
# ----------------------------------------------------------------
421
417
# Array-Like / EA-Interface Methods
422
418
@@ -647,20 +643,6 @@ def take(self, indices, allow_fill=False, fill_value=None):
647
643
648
644
return type (self )(new_values , dtype = self .dtype )
649
645
650
- def where (self , cond , other ):
651
- i8 = self .asi8
652
- if lib .is_scalar (other ):
653
- if isna (other ):
654
- other = iNaT
655
- elif isinstance (other , self ._scalar_type ):
656
- self ._check_compatible_with (other )
657
- other = other .ordinal
658
- elif isinstance (other , type (self )):
659
- self ._check_compatible_with (other )
660
- other = other .asi8
661
- result = np .where (cond , i8 , other )
662
- return type (self )(result , dtype = self .dtype )
663
-
664
646
@classmethod
665
647
def _concat_same_type (cls , to_concat ):
666
648
dtypes = {x .dtype for x in to_concat }
@@ -1338,14 +1320,6 @@ def _reduce(self, name, skipna=True, **kwargs):
1338
1320
# --------------------------------------------------------------
1339
1321
# Reductions
1340
1322
1341
- def any (self , skipna = True ):
1342
- values = self ._values_for_reduction (skipna = skipna )
1343
- return len (values )
1344
-
1345
- def all (self , skipna = True ):
1346
- values = self ._values_for_reduction (skipna = skipna )
1347
- return len (values )
1348
-
1349
1323
def _values_for_reduction (self , skipna = True ):
1350
1324
if skipna :
1351
1325
values = self [~ self ._isnan ]
0 commit comments