clean way prepend an element to a numpy array

Robert Kern robert.kern at
Tue Jul 21 19:52:23 CEST 2009

On 2009-07-20 22:56, bdb112 wrote:
> If I want to add an element at the beginning of an array, it seems
> like I must make a list, insert in place, then make an array again.

the_array = numpy.concatenate([new_value, the_array])

You will want to ask numpy questions on the numpy mailing list.

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 Python-list mailing list