-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathData_Analysis_Web_App_Streamlit.py
More file actions
96 lines (69 loc) · 2.47 KB
/
Data_Analysis_Web_App_Streamlit.py
File metadata and controls
96 lines (69 loc) · 2.47 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Priyang Bhatt
# Imports
import streamlit as st
import pandas as pd
import seaborn as sns
# 1. Title and Subheader
st.title("Data Analysis")
st.subheader("Data Analysis Using Python & Streamlit")
# 2. Upload Dataset
upload = st.file_uploader("Upload Your Dataset (In CSV Format)")
if upload is not None:
data=pd.read_csv(upload)
# 3. Show Dataset
if upload is not None:
if st.checkbox("Preview Dataset"):
if st.button("Head"):
st.write(data.head())
if st.button("Tail"):
st.write(data.tail())
# 4. Check DataType of Each Column
if upload is not None:
if st.checkbox("DataType of Each Column"):
st.text("DataTypes")
st.write(data.dtypes)
# 5. Find Shape of Our Dataset (Number of Rows And Number of Columns)
if upload is not None:
data_shape=st.radio("What Dimension Do You Want To Check?",('Rows',
'Columns'))
if data_shape=='Rows':
st.text("Number of Rows")
st.write(data.shape[0])
if data_shape=='Columns':
st.text("Number of Columns")
st.write(data.shape[1])
# 6. Find Null Values in The Dataset
if upload is not None:
test=data.isnull().values.any()
if test==True:
if st.checkbox("Null Values in the dataset"):
sns.heatmap(data.isnull())
st.pyplot()
else:
st.success("Congratulations!!!,No Missing Values")
# 7. Find Duplicate Values in the dataset
if upload is not None:
test=data.duplicated().any()
if test==True:
st.warning("This Dataset Contains Some Duplicate Values")
dup=st.selectbox("Do You Want to Remove Duplicate Values?", \
("Select One","Yes","No"))
if dup=="Yes":
data=data.drop_duplicates()
st.text("Duplicate Values are Removed")
if dup=="No":
st.text("Ok No Problem")
if st.button('Save DataFrame'):
open('data_streamlit.csv','w').write(data.to_csv())
st.text("Saved To local Drive")
# 8. Get Overall Statistics
if upload is not None:
if st.checkbox("Summary of The Dataset"):
st.write(data.describe(include='all'))
# 9. About Section
if st.button("About App"):
st.text("Built With Streamlit")
st.text("Thanks To Streamlit")
# 10. By
if st.checkbox("By"):
st.success("Priyang Bhatt")