Skip to content

Commit a86e4cb

Browse files
committed
Cleanup
* remove unused where * standardize _format_native_types * remove unused strftime * remove unused any / all
1 parent f7d9cdb commit a86e4cb

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

pandas/core/arrays/datetimelike.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ class DatelikeOps(object):
149149

150150
def strftime(self, date_format):
151151
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))
154153
strftime.__doc__ = """
155154
Convert to Index using specified date_format.
156155
@@ -401,7 +400,7 @@ def _ndarray_values(self):
401400
# ------------------------------------------------------------------
402401
# Formatting
403402

404-
def _format_native_types(self):
403+
def _format_native_types(self, na_rep=u'NaT', date_format=None):
405404
"""
406405
Helper method for astype when converting to strings.
407406
@@ -414,9 +413,6 @@ def _format_native_types(self):
414413
def _formatter(self, boxed=False):
415414
return "'{}'".format
416415

417-
def strftime(self, date_format):
418-
return self._format_native_types(date_format=date_format)
419-
420416
# ----------------------------------------------------------------
421417
# Array-Like / EA-Interface Methods
422418

@@ -647,20 +643,6 @@ def take(self, indices, allow_fill=False, fill_value=None):
647643

648644
return type(self)(new_values, dtype=self.dtype)
649645

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-
664646
@classmethod
665647
def _concat_same_type(cls, to_concat):
666648
dtypes = {x.dtype for x in to_concat}
@@ -1338,14 +1320,6 @@ def _reduce(self, name, skipna=True, **kwargs):
13381320
# --------------------------------------------------------------
13391321
# Reductions
13401322

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-
13491323
def _values_for_reduction(self, skipna=True):
13501324
if skipna:
13511325
values = self[~self._isnan]

pandas/core/arrays/datetimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def _validate_fill_value(self, fill_value):
554554

555555
# -----------------------------------------------------------------
556556
# Formatting Methods
557-
def _format_native_types(self, na_rep='NaT', date_format=None, **kwargs):
557+
def _format_native_types(self, na_rep=u'NaT', date_format=None, **kwargs):
558558
from pandas.io.formats.format import _get_format_datetime64_from_values
559559
format = _get_format_datetime64_from_values(self, date_format)
560560

0 commit comments

Comments
 (0)