How To Flip Numpy Array Along The Diagonal Efficiently?
Lets say that i have the following array (note that there is a 1 in the [2,0] position and a 2 in the [3,4] position): [0, 0, 0, 0, 0] [0, 0, 0, 0, 0] [1, 0, 0, 0, 0] [0, 0, 0, 0,
Solution 1:
Both np.rot90(np.fliplr(x))
and transposing the array solves this.
a = np.random.uniform(size=(5,5))
a.T == np.rot90(np.fliplr(a))
Post a Comment for "How To Flip Numpy Array Along The Diagonal Efficiently?"