[Numpy-discussion] concatenate, doc-string

Christopher Barker Chris.Barker at noaa.gov
Thu Apr 27 00:10:03 EDT 2006


David M. Cooke wrote:

> Here's what I just checked in:
> 
>     concatenate((a1, a2, ...), axis=None) joins arrays together
> 
>     The tuple of sequences (a1, a2, ...) are joined along the given axis
>     (default is the first one) into a single numpy array.
> 
>     Example:
> 
>     >>> concatenate( ([0,1,2], [5,6,7]) )
>     array([0, 1, 2, 5, 6, 7])

While we're at it, why not an example of how the axis argument works:
 >>> concatenate( (ones((1,3)), zeros((1,3))) )
array([[1, 1, 1],
        [0, 0, 0]])

 >>> concatenate( (ones((1,3)), zeros((1,3))), axis = 0 )
array([[1, 1, 1],
        [0, 0, 0]])
 >>> concatenate( (ones((1,3)), zeros((1,3))), axis = 1 )
array([[1, 1, 1, 0, 0, 0]])


I'm not sure I like this example, but it's a easy way to do a one liner.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer
                                      		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the NumPy-Discussion mailing list