[Numpy-discussion] assign a variable to each column of an array
Timothy Hochberg
tim.hochberg at ieee.org
Sun Dec 16 22:20:28 EST 2007
On Dec 16, 2007 7:58 PM, elfnor <e.howick at irl.cri.nz> wrote:
> Is there a more concise way of assigning a variable to each column of an
> array?
>
> This works
>
> x,y,z = X[:,0],X[:,1],X[:,2]
>
> but seems clumsy.
You could try:
x, y, z = X.T
Although some people might think that's a little obscure...
--
. __
. |-\
.
. tim.hochberg at ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071216/67eaef11/attachment.html>
More information about the NumPy-Discussion
mailing list