-
Notifications
You must be signed in to change notification settings - Fork 27
/
Eda_web_app.py
51 lines (42 loc) · 1.54 KB
/
Eda_web_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import streamlit as st
from pandas_profiling import ProfileReport
from streamlit_pandas_profiling import st_profile_report
# web app ka title
st.markdown(''' # **Exploratory Data Analysis Web Application**
This app is developed by **babaAammar** ''')
# how to upload a file from pc
with st.sidebar.header("Upload your dataset (.csv)"):
upload_file=st.sidebar.file_uploader("Upload your dataset",type=["csv"])
df=sns.load_dataset('titanic')
st.sidebar.markdown("[Example CSV file](https://raw.githubusercontent.com/babaAammar/Eda_web_app/master/titanic.csv)")
# profiling report
if upload_file is not None:
@st.cache
def load_csv():
df=pd.read_csv(upload_file)
return df
df=load_csv()
pr=ProfileReport(df,explorative=True)
st.subheader("Input Data Profile")
st.write(df)
st.write('---')
st.header("Profiling Report with Pandas")
st_profile_report(pr)
else:
st.info("Please upload a csv file")
if st.button("Press to use Example Dataset"):
@st.cache
def load_dataset():
a=pd.DataFrame(np.random.randn(100,5),columns=['a_col','b_col','c_col','d_col','e_col'])
return a
df=load_dataset()
pr=ProfileReport(df,explorative=True)
st.subheader("Input Data Profile")
st.write(df)
st.write('---')
st.header("Profiling Report with Pandas")
st_profile_report(pr)