Created
March 15, 2018 13:33
-
-
Save rlabbe/d574eeac63fd126b2fcd1dc390cc3257 to your computer and use it in GitHub Desktop.
numpy recarray to dict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def as_dict(rec): | |
""" turn a numpy recarray record into a dict. this is mostly useful | |
just to have a human readable output of a record on the console. | |
as_dict(my_data[234]) | |
""" | |
return {name:rec[name] for name in rec.dtype.names} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment