[Numpy-discussion] creating column vectors

Sven Schreiber svetosch at gmx.net
Wed Feb 8 09:46:01 CST 2006


Gerard Vermeulen schrieb:

>> mat(arange(1,10)).transpose()
>>
>> works, but seems a bit long-winded (in comparison to MATLAB's [1:10]').

> 
> What about this?
> 
> arange(1, 10)[:, NewAxis]
> 

The numpy-book beats both of us (see my previous post) in terms of
minimal typing overhead by suggesting r_[1:10,'c'] which produces a
matrix type, very nice.
Compared to [1:10]', that's quite good already...
-sven





More information about the Numpy-discussion mailing list