How to index an array with even steps?

fl rxjwg98 at gmail.com
Fri Jul 25 07:56:18 EDT 2014


On Friday, July 25, 2014 7:45:31 AM UTC-4, fl wrote:
> to 999 of the target array. Then, I want to use interpolate it from 200 to 1000
> 
> with interpolate method.
> 
> In Python, ':' is used to indicate range (while in Matlab I know it can be used
> to control steps). How to index an array with 0, 5, 10, 15...995?
> 
> Thanks,

Sorry, I got it.
 x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> x[1:7:2]
array([1, 3, 5])



More information about the Python-list mailing list