[Numpy-discussion] numpy.rot90 bug with >2D arrays
Wed Sep 5 15:10:38 CDT 2007
numpy.rot90 (from twodim_base.by) says it works only on the first two
axes of an array, but due to its use of the transpose method (which
reverses the shape tuple), can affect other axes.
a = numpy.ones((50,40,3))
b = numpy.rot90(a)
assert(b.shape == (3,40,50))
# desired result is b.shape == (40,50,3)
I believe that the fix is to replace the two calls to 'transpose()'
in the function with 'swapaxes(0,1)'. This would allow rotating an
array along just the first two axes.
Does this fix look right? Should I file a bug or can someone just
check that in?
More information about the Numpy-discussion