|
import streamlit as st |
|
import pandas as pd |
|
import plotly.express as px |
|
|
|
st.set_page_config(page_title="AutoML Streamlit App", page_icon=":robot:", layout="wide") |
|
|
|
st.title("AutoML Streamlit App") |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload your dataset", type=["csv"]) |
|
if uploaded_file is not None: |
|
|
|
df = pd.read_csv(uploaded_file) |
|
st.dataframe(df.head()) |
|
|
|
|
|
numerical_cols = df.select_dtypes(include=["float", "int"]).columns |
|
categorical_cols = df.select_dtypes(include=["object"]).columns |
|
|
|
if st.button("Generate Plot"): |
|
if len(numerical_cols) >= 1: |
|
fig_hist = px.histogram(df, nbins=20, title="Histogram Plot") |
|
st.plotly_chart(fig_hist) |
|
|
|
fig_violin = px.violin(df, title="Violin Plot") |
|
st.plotly_chart(fig_violin) |
|
|
|
if len(numerical_cols) >= 2: |
|
fig_scatter = px.scatter_matrix(df, dimensions=numerical_cols, title="Scatter Matrix Plot") |
|
st.plotly_chart(fig_scatter) |
|
|
|
fig_ternary = px.line_ternary(df, a=numerical_cols[0], b=numerical_cols[1], c=numerical_cols[2], title="Line Ternary Plot") |
|
st.plotly_chart(fig_ternary) |
|
elif len(categorical_cols) >= 2: |
|
fig = px.treemap(df, path=categorical_cols, title="Treemap Plot") |
|
st.plotly_chart(fig) |
|
else: |
|
fig = px.sunburst(df, path=categorical_cols + numerical_cols, title="Sunburst Plot") |
|
st.plotly_chart(fig) |