← All ivy-nodes
IVYXSTUDIO · IVY NODE
D
Data Frame Creator
ivy.node.data-frame-creator · v0.0.0
ivyx✓
Creates a pandas DataFrame from a list of dictionaries. This is typically the starting point for data processing pipelines. Each dictionary in the list becomes a row in the DataFrame, with dictionary keys becoming column names. Use this node to convert structured data (e.g., from web-scraping or API responses) into a DataFrame for analysis. The output can be used with csv-from-data-frame for export or other data transformation nodes.
#data#frame#pandas#tabular data#manipulation#processing#table creation#data analysis#data import export
Inputs
| Field | Type | Description |
|---|---|---|
| dictionaryrequired | object | A list of dictionaries to be converted into a pandas DataFrame. (Node reference) |
| features | object | Features |
| labels | object | Labels |
Outputs
| Field | Type | Description |
|---|---|---|
| data_framerequired | object | Custom type: pd.DataFrame |
| features | object | Features |
| labels | object | Labels |
Source
python
# Input preparation
inp = __ivy_ctx__["nodes"][__ivy_node_id__]["input"]
dictionary = inp["dictionary"]
# Compute
import pandas as pd
from typing import List, Dict
class DataFrameCreator:
"""
A class to create a pandas DataFrame from a list of dictionaries.
"""
def __init__(self, dictionary: List[Dict]):
"""
Initialize the DataFrameCreator with the dictionary.
:param dictionary: A list of dictionaries to be converted into a pandas DataFrame.
"""
self.dictionary = dictionary
def create(self) -> pd.DataFrame:
"""
Create and return a pandas DataFrame from the provided dictionary.
:return: A pandas DataFrame.
"""
if not self.dictionary:
raise ValueError("No dictionary provided to create the DataFrame.")
return pd.DataFrame(self.dictionary)
data_frameCreator = DataFrameCreator(dictionary=dictionary)
data_frame = data_frameCreator.create()
print(data_frame)
# Output collection (runner reads __ivy_ctx__)
out = __ivy_ctx__["nodes"][__ivy_node_id__]["output"]
out["data_frame"] = data_frameTests
Requires: python:3.11
- basic-creation
Create DataFrame from valid dictionary list (should succeed).
dataframecreationbasic - error-empty-dictionary
Empty dictionary list should raise an error.
error-handlingvalidation