From: Charles R H. <cha...@gm...> - 2006-05-13 00:31:57
|
On 5/11/06, Bill Baxter <wb...@gm...> wrote: > > Ahh, I hadn't noticed the fromstring/fromfile methods. > > Hmm. That seems ok for making a row-at-a-time, but it doesn't support th= e > full syntax of the matrix string constructor, which allows for things li= ke > > >>> numpy.matrix("[1 2; 2 3;3 4]") > matrix([[1, 2], > [2, 3], > [3, 4]]) > You can reshape the array returned by fromstring, i.e., In [6]: fromstring("1 2 2 3 3 4", sep=3D" ").reshape(-1,2) Out[6]: array([[1, 2], [2, 3], [3, 4]]) Chuck |