[SciPy-user] Question about trick index functions.

Travis Oliphant oliphant.travis at ieee.org
Thu Jan 5 21:48:07 EST 2006


Hugo Gamboa wrote:

>I would like start to congratulate the community for the brave rename
>and quick release of NumPy!
>Following the discussions here, have been a very instructive
>experience on how a quality project is run in open and honest
>discussion.
>Thank you all.
>
>An now a question:
>
>When using the r_ and c_ functions from numpy:
>
>r_[1,2,3]
>
>gives the same result than
>
>c_[1,2,3]
>
>I tried to follow the code and tried the concatenate function:
>
>concatenate( ([1,2],[5,6]), axis=0
>  
>
>gives the same result as
>
>concatenate( ([1,2],[5,6]), axis=1)
>
>  
>
>Is this the correct behaviour?
>  
>

Yes, although perhaps an error could be raised in the second case.   The 
NumPy concatenate comes straight from Numeric  The problem is that [1,2] 
and [5,6] are both 1-d arrays so that they only have one axis to 
concatenate along.

>When I want to produce a column vector I need to do something like:
>
>r_[1,2,3].reshape((3,1))
>  
>
Yes, or

r_[1,2,3,'c']

which produces a 3x1 matrix.

-Travis




More information about the SciPy-User mailing list