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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -