dividing every alternate row of a 2D array with constant

Viewed 46

why is it changing two consecutive rows simultaneously rather than dividing the row assigned? For some reason the stride function is getting activated after the even rows are changed which in turn changing the odd rows. What can be the reason?

import numpy as np
a=np.arange(21)
b=np.lib.stride_tricks.as_strided(a,(6,6),strides=(12,4))
c=b
d=2
c.shape
for i in range(6):
   if i%2==0:
       print(i)
       print(c[i,:])
       c[i,:]=c[i,:]//d
       print(c)
   else:
       print(i)
       c[i]=c[i]
       print(c)
0 Answers
Related