[Numpy-discussion] Reshaping along an axis

Karthikesh Raju karthik at james.hut.fi
Fri Sep 3 06:35:10 CDT 2004


Hi all,

Suppose i have a tuple or a 1D array as

a = (1,2,3,4,5,6,7,8,9)

presently reshape(a,(3,3)) gives me

1 2 3
4 5 6
7 8 9

i.e reshaping is done column wise. How do one specifiy reshape to work row
wise as: reshape(a,(3,3)) =
1 4 7
2 5 8
3 6 9

With warm regards

karthik


-----------------------------------------------------------------------
Karthikesh Raju,		    email: karthik at james.hut.fi
                                           karthikesh.raju at gmail.com
Researcher,			    http://www.cis.hut.fi/karthik
Helsinki University of Technology,  Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc.,    Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------




More information about the Numpy-discussion mailing list