[Numpy-discussion] beginner question: rank-1 arrays

Gael Varoquaux gael.varoquaux@normalesup....
Mon Oct 8 17:18:48 CDT 2007


On Mon, Oct 08, 2007 at 11:12:07PM +0100, Robin wrote:
>    On 10/8/07, Gael Varoquaux <[1]gael.varoquaux@normalesup.org> wrote:

>      r_[0:10] and c_[0:10].

>      Does that suit you ? The first one is indeed only 1D, but I don't see
>      the
>      problem with that. If you really want 2D you can use c_[0:10].T .

>    Thanks, but not really :)

>    Firstly - for me I don' see any difference between the two, they both give
>    a numpy rank-1 array which doesn't have a row/column characteristic.
>    x.shape for both of the above is (10,) I need (10,1) or (1,10) for my
>    code.

Damn it. Shame on me. I meant c_[0:10,]. If you really need a shape of
(1,10) (I have never had such a need) you can use c_[0:10,].T.

HTH,

Gaël


More information about the Numpy-discussion mailing list