diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-28 14:03:27 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-05-25 22:55:58 -0700 |
commit | 905e906d55fdcb8cc215de8aa287ea9654d1c95c (patch) | |
tree | ba7d36006b940a87d1dff93a1a8965f7f986c2ab /numpy/core/fromnumeric.py | |
parent | 84f582f25e168dbfd59b3be470bc8ebc46ee2d92 (diff) | |
download | numpy-905e906d55fdcb8cc215de8aa287ea9654d1c95c.tar.gz |
ENH: Add (put|take)_along_axis as described in #8708
This is the reduced version that does not allow any insertion of extra dimensions
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 0db5663f9..d1aae0aa0 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -140,6 +140,7 @@ def take(a, indices, axis=None, out=None, mode='raise'): -------- compress : Take elements using a boolean mask ndarray.take : equivalent method + take_along_axis : Take elements by matching the array and the index arrays Notes ----- @@ -478,6 +479,7 @@ def put(a, ind, v, mode='raise'): See Also -------- putmask, place + put_along_axis : Put elements by matching the array and the index arrays Examples -------- @@ -723,7 +725,9 @@ def argpartition(a, kth, axis=-1, kind='introselect', order=None): ------- index_array : ndarray, int Array of indices that partition `a` along the specified axis. - In other words, ``a[index_array]`` yields a partitioned `a`. + If `a` is one-dimensional, ``a[index_array]`` yields a partitioned `a`. + More generally, ``np.take_along_axis(a, index_array, axis=a)`` always + yields the partitioned `a`, irrespective of dimensionality. See Also -------- @@ -904,6 +908,8 @@ def argsort(a, axis=-1, kind='quicksort', order=None): index_array : ndarray, int Array of indices that sort `a` along the specified axis. If `a` is one-dimensional, ``a[index_array]`` yields a sorted `a`. + More generally, ``np.take_along_axis(a, index_array, axis=a)`` always + yields the sorted `a`, irrespective of dimensionality. See Also -------- |