From 7efd5cf4cc6cd45f6114fdbc3fbfd619ddf03deb Mon Sep 17 00:00:00 2001 From: CJ Carey Date: Mon, 22 Sep 2014 14:30:36 -0400 Subject: BUG: np.unique with chararray + inverse_index The call to `empty_like` was trying to use the `chararray` subclass, which doesn't support the `np.intp` dtype. --- numpy/lib/arraysetops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/arraysetops.py') diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index bc80d0ecd..5c3b504de 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -204,7 +204,7 @@ def unique(ar, return_index=False, return_inverse=False, return_counts=False): ret += (perm[flag],) if return_inverse: iflag = np.cumsum(flag) - 1 - inv_idx = np.empty_like(ar, dtype=np.intp) + inv_idx = np.empty(ar.shape, dtype=np.intp) inv_idx[perm] = iflag ret += (inv_idx,) if return_counts: -- cgit v1.2.1