Spaces:
Sleeping
Sleeping
Download src/dashboard.py from ashantharosary/Forecast_Agent: direct link, hf CLI and curl.
- Browser
- Download file 601 Bytes
-
https://huggingface.co/spaces/ashantharosary/Forecast_Agent/resolve/main/src/dashboard.py
- Command line
-
hf download hf://spaces/ashantharosary/Forecast_Agent/src/dashboard.py
-
curl -L -o dashboard.py https://huggingface.co/spaces/ashantharosary/Forecast_Agent/resolve/main/src/dashboard.py
601 Bytes
| import streamlit as st | |
| import plotly.express as px | |
| class DashboardBuilder: | |
| def display(self, df): | |
| num_cols = df.select_dtypes("number").columns | |
| if len(num_cols) >= 2: | |
| fig = px.scatter(df, x=num_cols[0], y=num_cols[1], title=f"{num_cols[1]} vs {num_cols[0]}") | |
| st.plotly_chart(fig) | |
| elif len(num_cols) == 1: | |
| fig = px.histogram(df, x=num_cols[0], title=f"Distribution of {num_cols[0]}") | |
| st.plotly_chart(fig) | |
| else: | |
| st.warning("No numeric columns available for visualization.") | |
| st.dataframe(df.head()) | |