[SciPy-user] concatenate array with number

Bing bing.jian@gmail....
Thu Aug 7 11:34:05 CDT 2008


try this:
  numpy.r_[x,x[-1]]

On Thu, Aug 7, 2008 at 11:37 AM, Nicolas Chopin <
nicolas.chopin@bristol.ac.uk> wrote:

>      Hi list,
> I want to do this:
> x = concatenate( (x,x[-1]) )
> i.e. append to 1d array x its last element.
> However, the only way I managed to do this is:
> x  = concatenate( (x,array(x[-1],ndmin=1)) )
> which is a bit cryptic. (if you remove ndmin, it does not work.)
>
> 1. Is there a better way?
> 2. Could concatenate accept floating point numbers as arguments for
> convenience?
>
> Thanks in advance,
> Nicolas
>  <http://www.stats.bris.ac.uk/%7Emanxac/>
>  <http://www.stats.bris.ac.uk/%7Emanxac/>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080807/4c75cbf8/attachment.html 


More information about the SciPy-user mailing list