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
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
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
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
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
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