[Numpy-discussion] basic question about numpy arrays

John Salvatier jsalvati at u.washington.edu
Mon Aug 16 14:30:35 EDT 2010


You can also do:

y = x[:,0]

On Mon, Aug 16, 2010 at 11:28 AM, Skipper Seabold <jsseabold at gmail.com>wrote:

> On Mon, Aug 16, 2010 at 2:25 PM, gerardob <gberbeglia at gmail.com> wrote:
> >
> > I have a numpy array A , such that when i print A it appears:
> >
> > [[ 10.]
> >  [ 20.]]
> >
> > I would like to have a one dimensional array B (obtained from A) such
> that
> > B[0] = 10 and B[1]=20. It could be seen as the transpose of A.
> >
> > How can i obtain B = [10,20]  from A? I tried transpose(1,0) but it
> doesn't
> > seem to be useful.
> >
>
> B = A.squeeze()
>
> or
>
> B = A.flatten()
>
> would be two ways.
>
> Skipper
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100816/3edb540d/attachment.html>


More information about the NumPy-Discussion mailing list