-
-
Notifications
You must be signed in to change notification settings - Fork 2
incendium.dataset.from_list_of_dicts
César Román edited this page Apr 30, 2024
·
2 revisions
Safely convert a list of Python dictionaries into a Dataset.
Args:
- list_of_dicts (
list
[dict]): The list of dictionaries.
Returns:
-
Dataset
: A Dataset representation of the list of dictionaries.
This is particular useful in Vision when retrieving JSON data from an REST API.
None.
from __future__ import print_function
import system.net
import system.util
import incendium.dataset
raw_json = system.net.httpGet("https://jsonplaceholder.typicode.com/posts")
json_data = system.util.jsonDecode(raw_json)
posts = incendium.dataset.from_list_of_dicts(json_data)
for row in range(posts.getRowCount()):
for col in range(posts.getColumnCount()):
print(posts.getValueAt(row, col))