IdentifiantMot de passe
Mot de passe oublié ?Je m'inscris ! (gratuit)
12.3 Record array methods

12.3 Record array methods

RecArray object has these public methods:

field( fieldName)
fieldName can be either an integer (field index) or string (field name).
   >>> r=rec.array([[11,'abc',1.],[12, 'xx', 2.]])
   >>> print r.field('c1')
   [11 12]
   >>> print r.field(0)  # same as field('c1')
   [11 12]
To set values, simply use indexing or slicing, since each field is a numarray:
   >>> r.field(2)[1]=1000; r.field(1)[1]='xyz'
   >>> r.field(0)[:]=999
   >>> print r
   (999, 'abc', 1.0),
   (999, 'xyz', 1000.0)
info( )
This will display key attributes of the record array.

Send comments to the NumArray community.