summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-01-14 16:32:57 -0700
committerCharles Harris <charlesr.harris@gmail.com>2016-01-14 16:32:57 -0700
commit7141f40b58ed1e7071cde78ab7bc8ab37e9c5983 (patch)
tree856886f3b9d65fb6305f21f9d692cb0861b861cb /numpy/core/arrayprint.py
parent8fa6e3bef26a6d4a2c92f2824129aa4409be2590 (diff)
parent53ad26a84ac2aa6f5a37f09aa9feae5afed44f79 (diff)
downloadnumpy-7141f40b58ed1e7071cde78ab7bc8ab37e9c5983.tar.gz
Merge pull request #7001 from shoyer/NaT-comparison
API: make all comparisons with NaT false
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 fefcb6493..c5b5b5a8f 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':
- nat_value = array(['NaT'], dtype=data.dtype)[0]
- v = data[not_equal(data, nat_value)].view('i8')
+ # select non-NaT elements
+ v = data[data == data].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 + 1 == x:
+ if x != x:
return self._nat
else:
return self.format % x.astype('i8')