[Numpy-discussion] assign a variable to each column of an array
Timothy Hochberg
tim.hochberg@ieee....
Sun Dec 16 21:20:28 CST 2007
On Dec 16, 2007 7:58 PM, elfnor <e.howick@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@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071216/67eaef11/attachment.html
More information about the Numpy-discussion
mailing list