[SciPy-user] inverse of column_stack

Stefan van der Walt stefan at sun.ac.za
Tue Feb 21 10:52:45 CST 2006


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



More information about the SciPy-user mailing list