Suppose I have a 5x5 array:
import numpy as np
arr = np.random.rand(5,5)
If i want to sum the entire array I can simply have:
np.sum(arr)
How would i go about summing the values in a box defined by the upper left corner (2,2) and lower right corner (4,3)?
If this isnt clear i would like to sum the bold x's in the below array:
X X X X X
X X X X X
X X X X X
X X X X X
X X X X X