Feb. 7, 2007
10:07 p.m.
Christopher Barker schrieb:
Christian wrote:
when creating an ndarray from a list, how can I force the result to be 2d *and* a column vector? So in case I pass a nested list, there will be no modification of the shape and when I pass a simple list, it will be converted to a 2d column vector.
I'm not sure I understand the specification of the problem. I would think that the definition of a column vector is that it's shape is:
(-1,1)
So I think what's needed is: b = array(yourlist) b.reshape(b.shape[0], -1) Now it seems I finally understood this business with the -1 in the shapes... (well it's trivial if you have the book :-) -sven