Hi all,
I've got an easy question for you. I looked in Travis' book, but I couldn't
figure out the answer...
If I have an array1D (obtained reading a stream of numbers with
numpy.fromfile) like that:
In [150]: data
Out[150]: array([ 2., 3., 4., 3., 4., 5., 4., 5., 6., 5., 6.,
7.], dtype=float32)
I want it to be considered as "Fortran ordered", so that when I do:
In [151]: data.shape = (3,4)
I want to get:
array([[ 2., 3., 4., 5.],
[ 3., 4., 5., 6.],
[ 4., 5., 6., 7.]], dtype=float32)
But I get:
array([[ 2., 3., 4., 3.],
[ 4., 5., 4., 5.],
[ 6., 5., 6., 7.]], dtype=float32)
How can I do that?
(I know I could do data.reshape(4,3).T, but it's not very "elegant" and
reshaping in ND becomes a mess!).
(I tried with numpy.array(data, order = 'Fotran'), with no luck...)
Thank you in advance,
Lorenzo.