[Numpy-discussion] Slicing and structured arrays question

Hanno Klemm klemm@phys.ethz...
Tue Jan 27 06:24:38 CST 2009


Hi, 
I have the following question, that I could not find an answer to in the
example list, or by googling:

I have a record array with dtype such as:
dtype([('times', '<f8'), ('sensors', '|S8'), ('prop1', '<f8'), ('prop2',
'<f8'), ('prop3', '<f8'), ('prop4', '<f8')])

I would now like to calculate the mean and median for each of the
properties 'props'. Is there a way to do this similarly to a conventional
array with

a[:,2:].mean(axis=0)

or do I have to use a loop over the names of the properties? 

Thanks in advance,
Hanno







-- 
Hanno Klemm
klemm@phys.ethz.ch




More information about the Numpy-discussion mailing list