I have the code:
a=b=np.arange(9).reshape(3,3)
c=np.zeros(3)
for x in range(3):
    c[x]=np.average(b[np.where(a<x+3)])
The output of c is
>>>array([ 1. ,  1.5,  2. ])
Instead of the for loop, I wanna use array (vectorization), then I did the following code:
a=b=np.arange(9).reshape(3,3)
c=np.zeros(3)
i=np.arange(3)
c[i]=np.average(b[np.where(a<i[:,None,None]+3)])
But it shows IndexError: too many indices for array
As for a<i[:,None,None]+3
it correctly shows
array([[[ True,  True,  True],
        [False, False, False],
        [False, False, False]],
       [[ True,  True,  True],
        [ True, False, False],
        [False, False, False]],
       [[ True,  True,  True],
        [ True,  True, False],
        [False, False, False]]], dtype=bool)
But when I use b[np.where(a<i[:,None,None]+3)], it again shows IndexError: too many indices for array. I cannot get the correct output of c.