diff options
author | seberg <sebastian@sipsolutions.net> | 2013-01-23 02:09:35 -0800 |
---|---|---|
committer | seberg <sebastian@sipsolutions.net> | 2013-01-23 02:09:35 -0800 |
commit | dce10183bc8f3d243bd5fc70140f5ad71179d05c (patch) | |
tree | 4c4d9ef759b460d571c8ac40648a9e5f1fae8cf7 /numpy/core/fromnumeric.py | |
parent | 963c4e46dc56020ebea05bee10ceaa0feb61f022 (diff) | |
parent | cde76b4d11a580e6d25eebdcce373bc5d8c850f5 (diff) | |
download | numpy-dce10183bc8f3d243bd5fc70140f5ad71179d05c.tar.gz |
Merge pull request #2725 from seberg/take_0d
ENH: Allow 0-d indexes in np.take
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index d73f1313c..7596e3707 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -57,6 +57,10 @@ def take(a, indices, axis=None, out=None, mode='raise'): The source array. indices : array_like The indices of the values to extract. + + .. versionadded:: 1.8.0 + + Also allow scalars for indices. axis : int, optional The axis over which to select values. By default, the flattened input array is used. @@ -96,6 +100,11 @@ def take(a, indices, axis=None, out=None, mode='raise'): >>> a[indices] array([4, 3, 6]) + If `indices` is not one dimensional, the output also has these dimensions. + + >>> np.take(a, [[0, 1], [2, 3]]) + array([[4, 3], + [5, 7]]) """ try: take = a.take |