You could use scikit-image block_reduce:
import numpy as np
import skimage.measure
a = np.array([
[ 20, 200, -5, 23],
[ -13, 134, 119, 100],
[ 120, 32, 49, 25],
[-120, 12, 9, 23]
])
skimage.measure.block_reduce(a, (2,2), np.max)
Gives:
array([[200, 119],
[120, 49]])
Related Contents:
- What are the differences between numpy arrays and matrices? Which one should I use?
- numpy matrix vector multiplication [duplicate]
- Numpy matrix to array
- Convert a 1D array to a 2D array in numpy
- how does multiplication differ for NumPy Matrix vs Array classes?
- Why does numpy.linalg.solve() offer more precise matrix inversions than numpy.linalg.inv()?
- NumPy array/matrix of mixed types
- Find unique rows in numpy.array
- What are the advantages of NumPy over regular Python lists?
- Find the row indexes of several values in a numpy array
- Sorting arrays in NumPy by column
- How to print the full NumPy array, without truncation?
- Dump a NumPy array into a csv file
- Index a 2D Numpy array with 2 lists of indices
- How to access the ith column of a NumPy multidimensional array?
- numpy: most efficient frequency counts for unique values in an array
- How do I access the ith column of a NumPy multidimensional array?
- Working with big data in python and numpy, not enough ram, how to save partial results on disc?
- How to apply a disc shaped mask to a NumPy array?
- How to copy a 2D array into a 3rd dimension, N times?
- Frequency counts for unique values in a NumPy array
- Interweaving two numpy arrays
- Repeating each element of a numpy array 5 times
- Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?
- subsampling every nth entry in a numpy array
- How to get element-wise matrix multiplication (Hadamard product) in numpy?
- NumPy array initialization (fill with identical values)
- How to make a multidimension numpy array with a varying row size?
- Concatenate two NumPy arrays vertically
- Numpy – add row to array
- Ambiguity in Pandas Dataframe / Numpy Array “axis” definition
- numpy get index where value is true
- How to get a list of all indices of repeated elements in a numpy array
- Index 2D numpy array by a 2D array of indices without loops
- Selecting Random Windows from Multidimensional Numpy Array Rows
- Flattening a list of NumPy arrays?
- Deprecation status of the NumPy matrix class
- Why is a `for` over a Python list faster than over a Numpy array?
- Prevent numpy from creating a multidimensional array
- Input and output numpy arrays to h5py
- Efficient thresholding filter of an array with numpy
- How to create a numpy array of lists?
- How to count values in a certain range in a Numpy array?
- How to turn a video into numpy array?
- Numpy individual element access slower than for lists
- How to convert a 3d numpy array to 2d
- Add multiple values to one numpy array index
- Numpy array dimensions
- Set numpy array elements to zero if they are above a specific threshold
- Setting the fmt option in numpy.savetxt