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

Vishal Rana ranavishal at gmail.com
Thu Feb 4 17:26:35 EST 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.python.org/pipermail/numpy-discussion/attachments/20100204/e06a7560/attachment.html>


More information about the NumPy-Discussion mailing list