[Numpy-discussion] force column vector

Christian ckkart@hoc....
Wed Feb 7 19:01:31 CST 2007


Christopher Barker <Chris.Barker <at> noaa.gov> writes:

> 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)

I was not aware of that possibility althoug I own the book I - shame on me.
Thank you (and all others) for pointing that out.

What I want is a 2d array regardless of whether the input is a simple or 
nested list. However if it is a simple list I want the result to be a column
vector rather than a row vector, which happens by default.
Like Sven I'm wondering if there is solution without using any 'if'.
However using the subclassed array class which was proposed by Stefan is pretty
elegant.

Thanks to everybody, Christian





More information about the Numpy-discussion mailing list