summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-01-16 19:00:43 -0700
committerCharles Harris <charlesr.harris@gmail.com>2016-01-16 19:06:00 -0700
commite0cb3f79936656d6d2f48cbad46a3a9f2bad5ae1 (patch)
treed8b1410f9082ee82a4a7eb0d41b3a4dc3fe52ac4 /numpy/core/arrayprint.py
parentad4b5b03470a4ca2ef3150faa721a0e239b3c203 (diff)
downloadnumpy-e0cb3f79936656d6d2f48cbad46a3a9f2bad5ae1.tar.gz
Revert "Merge pull request #7001 from shoyer/NaT-comparison"
This reverts commit 7141f40b58ed1e7071cde78ab7bc8ab37e9c5983, reversing changes made to 8fa6e3bef26a6d4a2c92f2824129aa4409be2590. The original broke some pandas tests. The current plan to get this in is * reversion * issue FutureWarning in 1.11 and 1.12 * make the change in 1.13.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index c5b5b5a8f..fefcb6493 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -739,8 +739,8 @@ class DatetimeFormat(object):
class TimedeltaFormat(object):
def __init__(self, data):
if data.dtype.kind == 'm':
- # select non-NaT elements
- v = data[data == data].view('i8')
+ nat_value = array(['NaT'], dtype=data.dtype)[0]
+ v = data[not_equal(data, nat_value)].view('i8')
if len(v) > 0:
# Max str length of non-NaT elements
max_str_len = max(len(str(maximum.reduce(v))),
@@ -754,7 +754,7 @@ class TimedeltaFormat(object):
self._nat = "'NaT'".rjust(max_str_len)
def __call__(self, x):
- if x != x:
+ if x + 1 == x:
return self._nat
else:
return self.format % x.astype('i8')