Spaces:
Sleeping
Sleeping
| # run_viz_code.py | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| import pandas as pd | |
| def run_visualizations(df, visual_plan): | |
| globals_dict = { | |
| "df": df, | |
| "sns": sns, | |
| "plt": plt, | |
| "pd": pd | |
| } | |
| for viz in visual_plan: | |
| print(f"{viz['title']}: {viz['description']}") | |
| try: | |
| exec(viz["code"], globals_dict) | |
| except Exception as e: | |
| print(f"Failed to run code: {e}") | |