[SciPy-user] inverse of column_stack

Ryan Krauss ryanlists at gmail.com
Tue Feb 21 12:08:59 EST 2006


That's a good point.  Thanks Stefan.

I guess my main question is, is there a built-in way to do this
already.  If not, a cols function like your rows is what I will likely
do.  (For now I am actually doing (A.transpose()).tolist()).

Thanks,

Ryan

On 2/21/06, Stefan van der Walt <stefan at sun.ac.za> wrote:
> On Tue, Feb 21, 2006 at 11:39:03AM -0500, Ryan Krauss wrote:
> > A.tolist() will already iterate over the rows of a matrix, but your
> > suggestion could easily be adapted to a cols function.
>
> Also, the generator below does not copy data, unlike tolist.
>
> > On 2/21/06, Stefan van der Walt <stefan at sun.ac.za> wrote:
> > > You can always do
> > >
> > > def rows(A):
> > >     nr_rows = x.shape[0]
> > >     for r in range(nr_rows):
> > >         yield A[r,:]
> > >
> > > for r in rows(A):
> > >     print r
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>




More information about the SciPy-User mailing list