awacke1 commited on
Commit
0f87cf6
·
1 Parent(s): dce8e18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -27
app.py CHANGED
@@ -1,33 +1,39 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import plotly.express as px
4
- import pandas_profiling
5
 
6
- @st.cache
7
- def load_data(file):
8
- return pd.read_csv(file)
9
 
10
- def main():
11
- st.set_page_config(page_title="AutoML", page_icon=":robot:", layout="wide")
12
- st.title("AutoML Streamlit Application")
13
- file = st.file_uploader("Upload your CSV file", type=["csv"])
14
- if file is not None:
15
- df = load_data(file)
16
- st.dataframe(df.head(10))
17
- st.write("Statistics:")
18
- st.write(df.describe())
19
- st.write("Data Distribution:")
20
- st.write(df.hist())
21
- st.write("Pandas Profiling:")
22
- profile = df.profile_report(title="Pandas Profiling Report")
23
- st.write(profile)
24
- st.write("Pandas Profiling (Sunburst Chart):")
25
- sunburst = profile.get_final_html()
26
- st.write(sunburst, unsafe_allow_html=True)
27
- st.write("Filter by Column:")
28
- column = st.selectbox("Select Column", df.columns)
29
- filtered = df.sort_values(by=column)
30
- st.write(filtered)
31
 
32
- if __name__ == '__main__':
33
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  import plotly.express as px
 
4
 
5
+ st.set_page_config(page_title="AutoML Streamlit App", page_icon=":robot:", layout="wide")
 
 
6
 
7
+ st.title("AutoML Streamlit App")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ # Upload a CSV dataset
10
+ uploaded_file = st.file_uploader("Upload your dataset", type=["csv"])
11
+ if uploaded_file is not None:
12
+ # Load the dataset and display the first 5 rows
13
+ df = pd.read_csv(uploaded_file)
14
+ st.dataframe(df.head())
15
+
16
+ # Generate a treemap or sunburst plot based on data types
17
+ numerical_cols = df.select_dtypes(include=["float", "int"]).columns
18
+ categorical_cols = df.select_dtypes(include=["object"]).columns
19
+
20
+ if st.button("Generate Plot"):
21
+ if len(numerical_cols) >= 1:
22
+ fig_hist = px.histogram(df, nbins=20, title="Histogram Plot")
23
+ st.plotly_chart(fig_hist)
24
+
25
+ fig_violin = px.violin(df, title="Violin Plot")
26
+ st.plotly_chart(fig_violin)
27
+
28
+ if len(numerical_cols) >= 2:
29
+ fig_scatter = px.scatter_matrix(df, dimensions=numerical_cols, title="Scatter Matrix Plot")
30
+ st.plotly_chart(fig_scatter)
31
+
32
+ fig_ternary = px.line_ternary(df, a=numerical_cols[0], b=numerical_cols[1], c=numerical_cols[2], title="Line Ternary Plot")
33
+ st.plotly_chart(fig_ternary)
34
+ elif len(categorical_cols) >= 2:
35
+ fig = px.treemap(df, path=categorical_cols, title="Treemap Plot")
36
+ st.plotly_chart(fig)
37
+ else:
38
+ fig = px.sunburst(df, path=categorical_cols + numerical_cols, title="Sunburst Plot")
39
+ st.plotly_chart(fig)