compare two following values in numpy array

Posted by Billy Mitchell on Stack Overflow See other posts from Stack Overflow or by Billy Mitchell
Published on 2010-03-24T16:50:45Z Indexed on 2010/03/24 16:53 UTC
Read the original article Hit count: 246

Filed under:
|
|
|
|

What is the best way to touch two following values in an numpy array?

example:

npdata = np.array([13,15,20,25])
for i in range( len(npdata) ):
    print npdata[i] - npdata[i+1]

this looks really messed up and additionally needs exception code for the last iteration of the loop. any ideas?

Thanks!

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy