diff options
author | pierregm <pierregm@localhost> | 2009-01-19 09:01:24 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2009-01-19 09:01:24 +0000 |
commit | 0061e1821d58636d92f7f2917fc94351f34daa98 (patch) | |
tree | dda0f6061413291f03af7ca69d4cc0788762674e /numpy/lib/arraysetops.py | |
parent | 767ea8504509a32f092be069df1ea07c2452f85a (diff) | |
download | numpy-0061e1821d58636d92f7f2917fc94351f34daa98.tar.gz |
* replace np.asarray by np.asanyarray in unique1d
Diffstat (limited to 'numpy/lib/arraysetops.py')
-rw-r--r-- | numpy/lib/arraysetops.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index 49a1d3e89..f023f6027 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -52,13 +52,19 @@ def ediff1d(ary, to_end=None, to_begin=None): If provided, this number will be taked onto the beginning of the returned differences. + Notes + ----- + When applied to masked arrays, this function drops the mask information + if the `to_begin` and/or `to_end` parameters are used + + Returns ------- ed : array The differences. Loosely, this will be (ary[1:] - ary[:-1]). """ - ary = np.asarray(ary).flat + ary = np.asanyarray(ary).flat ed = ary[1:] - ary[:-1] arrays = [ed] if to_begin is not None: @@ -132,7 +138,7 @@ def unique1d(ar1, return_index=False, return_inverse=False): "the output was (indices, unique_arr), but " "has now been reversed to be more consistent.") - ar = np.asarray(ar1).flatten() + ar = np.asanyarray(ar1).flatten() if ar.size == 0: if return_inverse and return_index: return ar, np.empty(0, np.bool), np.empty(0, np.bool) |