summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-01-16 21:44:13 -0700
committerCharles Harris <charlesr.harris@gmail.com>2016-01-16 21:44:13 -0700
commit947b023a4999ec879b745c3e7b903d16d9ae65a1 (patch)
tree4117073e33890318be849bc23fe4b2ace82324e4 /numpy/core/arrayprint.py
parent865c3e375a598e5a0f7d9e690eda4702de8658af (diff)
parente0cb3f79936656d6d2f48cbad46a3a9f2bad5ae1 (diff)
downloadnumpy-947b023a4999ec879b745c3e7b903d16d9ae65a1.tar.gz
Merge pull request #7042 from charris/revert-7001
Revert "Merge pull request #7001 from shoyer/NaT-comparison"
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 74a9d3da3..282fbd1cf 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -733,8 +733,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))),
@@ -748,7 +748,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')