Re: [Tutor] Converting a numpy matrix to a numpy array

2011-04-04 Thread Peter Otten
David Crisp wrote: > np.array([np.arange(9)//3, np.arange(9)%3, a.flatten()], >> dtype=object).transpose() >> array([[0, 0, x], >> [0, 1, o], >> [0, 2, o], >> [1, 0, o], >> [1, 1, x], >> [1, 2, x], >> [2, 0, o], >> [2, 1, x], >> [2, 2, o]], dtype=object) >> >> If that's not good enough you may

Re: [Tutor] Converting a numpy matrix to a numpy array

2011-04-03 Thread Kane Dou
This may work: from pprint import pprint plan = """xo xo ox oo ox ox """ width = plan.index("\n") height = plan.count("\n") a = [[w, h] for h in xrange(height) for w in xrange(width)] for (xy, c) in zip(a, plan.replace("\n", "")): xy.append(c) pprint(a) |46>%run tes

Re: [Tutor] Converting a numpy matrix to a numpy array

2011-04-03 Thread David Crisp
On Fri, Apr 1, 2011 at 2:04 AM, Peter Otten <__pete...@web.de> wrote: > David Crisp wrote: > >> Hello, >> >> I have a very simple question / problem I need answered.  The problem >> is imnot entirely sure of the correct terminology and langauge to use >> to describe it.  (One of the reasons im usin

Re: [Tutor] Converting a numpy matrix to a numpy array

2011-03-31 Thread Peter Otten
David Crisp wrote: > Hello, > > I have a very simple question / problem I need answered. The problem > is imnot entirely sure of the correct terminology and langauge to use > to describe it. (One of the reasons im using this miling list) > > I have a 2d matrix representing the X the Y and the

Re: [Tutor] Converting a numpy matrix to a numpy array

2011-03-31 Thread Steven D'Aprano
David Crisp wrote: I have a 2d matrix representing the X the Y and the Z value of a point. I wish to convert that matrix to an array.What is a good way of doing so? Eg: Matrix 012345 0xo 1xo 2ox 3oo 4ox 5ox It's not clear what this matrix actually is. Is this fro

[Tutor] Converting a numpy matrix to a numpy array

2011-03-30 Thread David Crisp
Hello, I have a very simple question / problem I need answered.  The problem is imnot entirely sure of the correct terminology and langauge to use to describe it.  (One of the reasons im using this miling list) I have a 2d matrix representing the X the Y and the Z value of a point.  I wish to con