You can use np.take
.
For example:
b.take(index, axis=5)
More Related Contents:
- Using numpy to build an array of all combinations of two arrays
- Understanding NumPy’s einsum
- Intuition and idea behind reshaping 4D array to 2D array in NumPy
- Why is numpy’s einsum faster than numpy’s built in functions?
- Calculate mean across dimension in a 2D array
- Selecting specific rows and columns from NumPy array
- Get the position of the largest value in a multi-dimensional NumPy array
- Convert a 1D array to a 2D array in numpy
- Generalise slicing operation in a NumPy array
- Subsetting a 2D numpy array
- Check if two 3D numpy arrays contain overlapping 2D arrays
- Selecting Random Windows from Multidimensional Numpy Array Rows
- How to split a numpy array in fixed size chunks with and without overlap?
- How to find the index of a value in 2d array in Python?
- What is the difference between ndarray and array in NumPy?
- Numpy: For every element in one array, find the index in another array
- Numpy sub-array assignment with advanced, mixed indexing
- How is numpy’s fancy indexing implemented?
- Python: how to store a numpy multidimensional array in PyTables?
- How does the axis parameter from NumPy work?
- Get the indices of N highest values in an ndarray
- Mapping a NumPy array in place
- How to convert a 3d numpy array to 2d
- How to access the ith column of a NumPy multidimensional array?
- Concatenating two one-dimensional NumPy arrays
- Force NumPy ndarray to take ownership of its memory in Cython
- How to normalize a NumPy array to within a certain range?
- How do I use np.newaxis?
- Repeat each values of an array different times
- How to create 2d array with numpy random.choice for every rows?