Array assigment with Numeric.py

Janko Hauser jhauser at ifm.uni-kiel.de
Tue May 30 12:32:51 EDT 2000


The example you presented worked for me, (with the small error in the
definition of c).

>>> c = array([[1.0, 2.0, 3.0, 4.0],[5.0, 6.0, 7.0 ,8.0]])
>>> c.shape 
(2, 4)
>>> (2,4) 
(2, 4)
>>> d = array([9.0, 11.0, 3.0, 12.0, 15.0, 20.0]) 
>>> d.shape 
(6,)
>>> (1,6) 
(1, 6)
>>> temp = d[0] * d[5] 
>>> c[0,0] = temp 
>>> c[0,0] = d[0] * d[5]
>>> c[0,0]
180.0

Can you present an example which fails for you? 

__Janko
-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany



More information about the Python-list mailing list