python - How in a numpy array we can select just rows that are multiples of for example 3? -


i search numpy statement doing this:

if a = [11,12,13,14,15,16,17,18,19,20,21] , b=3 then:

c = [rows multiples of b]=[11,14,17,20] 

the following should work:

a[::b] 

result:

array([11, 14, 17, 20]) 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -