Skip to content

incendium.dataset.from_list_of_dicts

César Román edited this page Apr 30, 2024 · 2 revisions

Description

Safely convert a list of Python dictionaries into a Dataset.

Syntax

incendium.dataset.from_list_of_dicts(list_of_dicts)

Args:

  • list_of_dicts (list[dict]): The list of dictionaries.

Returns:

  • Dataset: A Dataset representation of the list of dictionaries.

Note

This is particular useful in Vision when retrieving JSON data from an REST API.

Recommendations

None.

Code Examples

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))
Clone this wiki locally