[Numpy-discussion] Reversing elements of array
Francesc Altet
faltet at carabos.com
Mon Jul 18 11:23:07 EDT 2005
A Monday 18 July 2005 20:00, Egg va escriure:
> I would like to reverse the elements of an array (or vector). If it were a
> regular Python list, I could say L.reverse(). If it were in Matlab (ick),
> I could say U(4:-1:1). Can anyone give me a hint on doing this in Numeric
> (not Numarray)?
>>> import Numeric
>>> a=Numeric.arange(10)
>>> a[::-1]
array([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
(the same works for python lists)
Cheers,
--
>0,0< Francesc Altet http://www.carabos.com/
V V Cárabos Coop. V. Enjoy Data
"-"
More information about the NumPy-Discussion
mailing list