diff options
author | RedRuM <44142765+zoj613@users.noreply.github.com> | 2019-11-03 19:53:08 +0200 |
---|---|---|
committer | RedRuM <44142765+zoj613@users.noreply.github.com> | 2019-11-03 19:53:08 +0200 |
commit | 87840dc2f09ebeed12c3b9fef68b94dc04f4d16f (patch) | |
tree | f746eeaa31cb757de6ee7cb5253c6ae4c0b4218c /numpy/lib/arraysetops.py | |
parent | 0117379f1c751296c914ffe9547a84380219b588 (diff) | |
parent | 2be03c8d25b14b654064e953feac7d210e6bd44d (diff) | |
download | numpy-87840dc2f09ebeed12c3b9fef68b94dc04f4d16f.tar.gz |
merge latest changes on master branch
Diffstat (limited to 'numpy/lib/arraysetops.py')
-rw-r--r-- | numpy/lib/arraysetops.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index f3f4bc17e..2309f7e42 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -213,6 +213,7 @@ def unique(ar, return_index=False, return_inverse=False, ----- When an axis is specified the subarrays indexed by the axis are sorted. This is done by making the specified axis the first dimension of the array + (move the axis to the first dimension to keep the order of the other axes) and then flattening the subarrays in C order. The flattened subarrays are then viewed as a structured type with each element given a label, with the effect that we end up with a 1-D array of structured types that can be @@ -264,7 +265,7 @@ def unique(ar, return_index=False, return_inverse=False, # axis was specified and not None try: - ar = np.swapaxes(ar, axis, 0) + ar = np.moveaxis(ar, axis, 0) except np.AxisError: # this removes the "axis1" or "axis2" prefix from the error message raise np.AxisError(axis, ar.ndim) @@ -285,7 +286,7 @@ def unique(ar, return_index=False, return_inverse=False, def reshape_uniq(uniq): uniq = uniq.view(orig_dtype) uniq = uniq.reshape(-1, *orig_shape[1:]) - uniq = np.swapaxes(uniq, 0, axis) + uniq = np.moveaxis(uniq, 0, axis) return uniq output = _unique1d(consolidated, return_index, |