Ryan Krauss wrote:
Is there an inverse function to column_stack? i.e. I want to iterate over the columns of a matrix. I could first transpose it and then call tolist, but I was wondering if there was some clean, fast, built in way that I wasn't aware of.
You can iterate over arrays. In [1]: a = reshape(arange(12),(3,4)) In [2]: a Out[2]: array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) In [3]: for x in a: ...: print x ...: ...: [0 1 2 3] [4 5 6 7] [ 8 9 10 11] In [4]: for x in transpose(a): ...: print x ...: ...: [0 4 8] [1 5 9] [ 2 6 10] [ 3 7 11] -- Robert Kern robert.kern@gmail.com "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter