[Numpy-discussion] dunno what array operation I'm looking for...
Chris Withers
chris at simplistix.co.uk
Fri Mar 21 22:43:04 EDT 2008
Hi All,
Say I have an array like:
>>> measurements = array([100,109,115,117])
What do I do to it to get:
array([9, 6, 2])
Is the following really the best way?
>>> result = []
>>> for i in range(1,len(measurements)):
... result.append(measurements[i]-measurements[i-1])
...
>>> array(result)
array([9, 6, 2])
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the NumPy-Discussion
mailing list