[Numpy-discussion] extending a recarray

Robert Kern robert.kern@gmail....
Fri Jan 25 14:55:34 CST 2008

Kevin Christman wrote:
> I am using recarray to store experiment information that is read from a file:
> self.records = numpy.rec.fromrecords(self.allData,formats='f4,S30,S30,f4,f4,f4,f4,f4,f4,f4,f4,f4,f4',names='MotorNum,MotorType,MotorName,MotorHP, NSync,NShaftFL,NShaft,pLoad,pLoadSlipMethod, pLoadORMEL,etaMeasured,etaORMEL,etaNameplate')
> Now I would like to add additional "columns" to this array for my calculations/analysis of the data.  How is this done?  Thanks,

You need to make a new dtype with the new columns. Then make an empty array with 
the new dtype. Copy in each column from the old array. Add the new column's 
data. For example:


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