[Numpy-discussion] Efficiently converting numpy record array to a list of dictionary

Vishal Rana ranavishal@gmail....
Thu Feb 4 16:26:35 CST 2010

How do I convert the numpy record array below:

recs = [('Bill', 31, 260.0), ('Fred', 15, 145.0)]
r = rec.fromrecords(recs, names='name, age, weight', formats='S30, i2, f4')

to a list of dictionary like:

[{'name': 'Bill', 'age': 31, 'weight': 260.0},
'name': 'Fred', 'age': 15, 'weight': 145.0}]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100204/e06a7560/attachment-0001.html 

More information about the NumPy-Discussion mailing list