[Numpy-discussion] numpy.numarray.transpose()

Michael.Walker@sophia.inr... Michael.Walker@sophia.inr...
Mon Sep 28 03:07:47 CDT 2009


Hello list,
       I just thought I'd point out a difference between 'import numarray'
and 'import numpy.numarray' . Consider the following

In [1]: from numpy.numarray import *
In [2]: d = array((1,2,3,4))
In [3]: f = reshape(d,(2,2))
In [4]: print f
[[1 2]
 [3 4]]

In [5]: f.transpose()
Out[5]:
array([[1, 3],
       [2, 4]])

In [6]: print f
[[1 2]
 [3 4]]


Now in pure numarray, f would have changed to the transposed form, so that
the output from [5] and [6] would match, and be different from that of
[4].
(I don't have numarray installed myself but a workmates computer, and
examples on the web have the usage  f.transpose() . Now,

In [7]: f = f.transpose()

In [8]: print f
[[1 3]
 [2 4]]

as expected. I mention this because I think that it is worth knowing
having lost a LOT  of time to it. Is it worth filing as a bug report?

Michael Walker

Plant Modelling Group
CIRAD, Montpellier
04 67 61 57 27


More information about the NumPy-Discussion mailing list