Allowing slices as arguments for ndarray.take

Jan. 17, 2014
12:28 a.m.
There was a discussion last year about slicing along specified axes in numpy arrays: http://mail.scipy.org/pipermail/numpy-discussion/2012-April/061632.html I'm finding that slicing along specified axes is a common task for me when writing code to manipulate N-D arrays. The method ndarray.take basically does what I would like, except it cannot take slice objects as argument. In the mean-time, I've written a little helper function: def take(a, indices, axis): index = [slice(None)] * a.ndim index[axis] = indices return a[tuple(index)] Is there support for allowing the `indices` argument to `take` to take Python slice objects as well as arrays? That would alleviate the need for my helper function. Cheers, Stephan

4152
Age (days ago)
4152
Last active (days ago)
1 comments
2 participants
participants (2)
-
sebastian
-
Stephan Hoyer