[Numpy-discussion] when and where to use numpy arrays vs nested lists

Francesc Altet faltet@carabos....
Thu Mar 1 13:22:44 CST 2007


El dj 01 de 03 del 2007 a les 12:03 -0700, en/na Mark P. Miller va
escriure:
> Sorry to pester, but is this the intended behavior of itemset?
> 
>  >>> array1=numpy.zeros((10,10),int)
>  >>> array1
> array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
>  >>> array1.itemset(5,5,9)

try with 

>>> array1.itemset((5,5),9)

HTH,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth



More information about the Numpy-discussion mailing list