[Numpy-discussion] [Numpy-tickets] [NumPy] #235: r_, c_, hstack, vstack, column_stack should be made more consistent

Travis Oliphant oliphant.travis at ieee.org
Wed Sep 13 23:56:22 EDT 2006


Sebastian Haase wrote:
> Travis,
> what is the "new string directives as the first element of the item 
> tuple" !?
>   

These have been there for a while, but I recently added a couple of 
capabilities.

> I always liked the idea of having a "shortest possible" way for creating 
>   (or concatenating)
> rows with "r_"
> *and*
> columns with "c_"
> !
>
> Why did the "c_" have to be removed !?
>   

It wasn't removed, I thought to deprecate it.  Owing to your response 
and the fact that others seem to use c_ quite a bit, I've kept it as a 
short hand for

r_['1,2,0', ...]

This means that arrays will be concatenated along the 1st axis after 
being up-graded to (at-least) 2-dimensional arrays with 1's placed at 
the end of the new shape.

Thus,

c_[[1,2,3],[4,5,6]

produces

array([[1, 4],
       [2, 5],
       [3, 6]])

This is a bit different if you were using c_ when you should have been 
using r_.

-Travis






More information about the NumPy-Discussion mailing list