[Numpy-discussion] Initialize numpy array with other numpy arrays

Robert Kern robert.kern at gmail.com
Fri Feb 20 10:45:38 EST 2009


On Fri, Feb 20, 2009 at 02:22, Fabrice Silva <silva at lma.cnrs-mrs.fr> wrote:
>> On Thu, Feb 19, 2009 at 17:03, Frank Peacock <frank at gis4weather.com> wrote:
>> > img[ngridn,ngride]=(ncolour[0],ncolour[1],ncolour[2])
>
> Le jeudi 19 février 2009 à 18:24 -0600, Robert Kern a écrit :
>> for i in range(3):
>>     img[ngridn,ngride,i] = ncolour[i]
>
> Is it not possible to simply use
>        img[ngridn, ngride, :] = ncolour[:]

No. This would, though:

  img[ngridn, ngride, :] = ncolour.T

-- 
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