Scrapegraph-ai/scrapegraphai/utils/prettify_exec_info.py
2024-05-01 12:35:12 +02:00

26 lines
764 B
Python

"""
Prettify the execution information of the graph.
"""
import pandas as pd
def prettify_exec_info(complete_result: list[dict]) -> pd.DataFrame:
"""
Transforms the execution information of a graph into a DataFrame for enhanced visualization.
Args:
complete_result (list[dict]): The complete execution information of the graph.
Returns:
pd.DataFrame: A DataFrame that organizes the execution information for better readability and analysis.
Example:
>>> prettify_exec_info([{'node': 'A', 'status': 'success'}, {'node': 'B', 'status': 'failure'}])
DataFrame with columns 'node' and 'status' showing execution results for each node.
"""
df_nodes = pd.DataFrame(complete_result)
return df_nodes