Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75201

Re: How to index an array with even steps?

Newsgroups comp.lang.python
Date 2014-07-25 04:56 -0700
References <9160a3c5-ff5f-4fb2-a125-4a1be28438b9@googlegroups.com>
Message-ID <460a5ed0-df63-4018-bcc9-c266daca525b@googlegroups.com> (permalink)
Subject Re: How to index an array with even steps?
From fl <rxjwg98@gmail.com>

Show all headers | View raw


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])

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to index an array with even steps? fl <rxjwg98@gmail.com> - 2014-07-25 04:45 -0700
  Re: How to index an array with even steps? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-25 11:55 +0000
  Re: How to index an array with even steps? fl <rxjwg98@gmail.com> - 2014-07-25 04:56 -0700
  Re: How to index an array with even steps? Akira Li <4kir4.1i@gmail.com> - 2014-07-25 16:02 +0400

csiph-web