[Numpy-discussion] concatenate an array with a number

Robert Kern robert.kern@gmail....
Mon Aug 4 11:10:49 CDT 2008


On Mon, Aug 4, 2008 at 09:58, Nicolas Chopin <nicolas.chopin@bris.ac.uk> wrote:
> Hi list,
> I want to do this:
>
> y = concatenate(x[0],x)
>
> where x is a 1d array.
> However, the only way I managed to make this work is:
>
> y = concatenate( array((x[0],),ndmin=1), x)
>
> which is kind of cryptic. (If I remove ndmin, numpy still complains.)
>
> 1. Is there a better way?

atleast_1d()

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the Numpy-discussion mailing list