numpy array operation

Tim Williams tjandacw at cox.net
Tue Jan 29 07:59:43 EST 2013


On Tuesday, January 29, 2013 3:41:54 AM UTC-5, C. Ng wrote:
> Is there a numpy operation that does the following to the array?
> 
> 
> 
> 1 2  ==>  4 3
> 
> 3 4       2 1
> 
> 
> 
> Thanks in advance.

>>> import numpy as np
>>> a=np.array([[1,2],[3,4]])
>>> a
array([[1, 2],
       [3, 4]])
>>> np.fliplr(np.flipud(a))
array([[4, 3],
       [2, 1]])




More information about the Python-list mailing list