I'm given such 2D-array.
My task is to find max values in subarrays painted by different colours. I have to use strides and as_strided. So far my code looked like this:
a=np.vstack(([0,1,2,3,4,5],[6,7,8,9,10,11],[12,13,14,15,16,17],[18,19,20,21,22,23]))
print(np.max(np.lib.stride_tricks.as_strided(a,(2,3),strides=(24,4))))
It properly shows the maximum value of the first block, which is 8, but i have no idea how can i move to the other parts of the matrix.Is there any way i could move to the other parts of the matrix so i could show the max value of the subarray?
NOTE: This task is from my introduction classes to python programming, so there is no need to write any sophisticated functions, i would even say it is inadvisable