What is :: (double colon) in numpy like in myarray[0::3]? [duplicate] What is :: (double colon) in numpy like in myarray[0::3]? [duplicate] numpy numpy

What is :: (double colon) in numpy like in myarray[0::3]? [duplicate]


It prints every yth element from the list / array

>>> a = [1,2,3,4,5,6,7,8,9]>>> a[::3][1, 4, 7]

The additional syntax of a[x::y] means get every yth element starting at position x

ie.

>>> a[2::3][3, 6, 9]