Hanno Klemm wrote: > 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? > You must first view the array as a float array in order to calculate the mean:
This should work: b = a.view(float) b.shape = (-1,6) b[:,2:].mean(axis=0) -Travis _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion