I'd like to be able to create a Dataset from plain python dicts. I read through just about everything in the docs and some of the code, and can't seem to find a way to do this directly.
What I'd like to be able to do is something like:
source_data = [
{'column_1': 'value_1A', 'column_2': 'value_2A'},
{'column_1': 'value_1B', 'column_2': 'value_2B'},
]
data = Dataset().load(*source_data)
Or maybe:
data = import_set(source_data, format='dict')
Current workarounds:
json.dumps the data first before loading
- Register a custom format class
- Separately add headers and row values:
data = DataSet()
data.headers = source_data[0].keys()
data.extend([item.values() for item in source_data])
So I guess my questions are:
- Is there currently a better way to do this?
- If not, would you be interested in a PR for this?
I'd like to be able to create a Dataset from plain python dicts. I read through just about everything in the docs and some of the code, and can't seem to find a way to do this directly.
What I'd like to be able to do is something like:
Or maybe:
Current workarounds:
json.dumpsthe data first before loadingSo I guess my questions are: