[SciPy-user] reverse an array

Ravi lists_ravi at lavabit.com
Mon Mar 2 10:41:01 EST 2009


On Friday 27 February 2009 22:02:30 Williamson, Ross wrote:
> Is there an easy way to reverse an array without converting it to a list?

Two ways:
   x = array([0,1,2,3,4])
   y1 = flipud( x ) # See also fliplr
   y2 = x[ ::-1 ]

Regards,
Ravi





More information about the SciPy-User mailing list