np.ix_ a try:
This returns your desired result:
In : Y = np.arange(16).reshape(4,4) In : Y[np.ix_([0,3],[0,3])] Out: array([[ 0, 3], [12, 15]])
More Related Contents:
- Convert a 3D array to RGB valued array [closed]
- Unable to allocate array with shape and data type
- Replacing Numpy elements if condition is met
- How to make a multidimension numpy array with a varying row size?
- Matplotlib log scale tick label number formatting
- What does the term “broadcasting” mean in Pandas documentation?
- Save / load scipy sparse csr_matrix in portable data format
- Working with TIFFs (import, export) in Python using numpy
- Shift elements in a numpy array
- Numpy and line intersections
- Numpy: Creating a complex array from 2 real ones?
- Are Decimal ‘dtypes’ available in NumPy?
- Fill zero values of 1d numpy array with last non-zero values
- Error “Import Error: No module named numpy” on Windows
- Binary numpy array to list of integers?
- What is the difference between np.array() and np.asarray()?
- Weighted percentile using numpy
- test for membership in a 2d numpy array
- Replace sub part of matrix by another small matrix in numpy
- Why is Numpy much faster at creating a Zero array compared to replacing the values of an existing array with zeros?
- Find large number of consecutive values fulfilling condition in a numpy array
- How to automatically annotate maximum value in pyplot
- Why does python/numpy’s += mutate the original array?
- Complex matlab-like data structure in python (numpy/scipy)
- Multiple matrix multiplication
- How to have logarithmic bins in a Python histogram
- Interpolating a closed curve using scipy
- Procrustes Analysis with NumPy?
- Numpy: argmax over multiple axes without loop
- Numpy.Array in Python list?