Forecast_Agent / src /dashboard.py
ashantharosary's picture
Update src/dashboard.py
ba133f0 verified
Raw
History Blame Contribute Delete
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())