From 0ab1a2b12baabe3bd7063e2963c83482a4f57016 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 1 Aug 2017 17:41:28 +0000 Subject: MAINT: Simplify test for string-likes --- numpy/core/numeric.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 13a99505c..7d53f2b68 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -436,8 +436,7 @@ def count_nonzero(a, axis=None): if issubdtype(a.dtype, np.number): return (a != 0).sum(axis=axis, dtype=np.intp) - if (issubdtype(a.dtype, np.string_) or - issubdtype(a.dtype, np.unicode_)): + if issubdtype(a.dtype, np.character): nullstr = a.dtype.type('') return (a != nullstr).sum(axis=axis, dtype=np.intp) -- cgit v1.2.1