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) which makes it easy: def MakeColumn(input): a = asarray(input) a.shape = (-1,1) return a however, if you want: MakeColumn([[1,2],[3,4],[5,6]]) to return: array([[1, 2], [3, 4], [5, 6]]) that's not what I would call a column vector, and if that's what you want, then what would you want: MakeColumn([[1,2,3,4],[5,6,7,8]]) to return? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion