-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stremlit
87 lines (70 loc) · 2.37 KB
/
Stremlit
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
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 27 22:59:32 2024
@author: dell
"""
import streamlit as st
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
# 1. Title and Subheader
st.title("Data Analysis")
st.subheader("Data analysis using python and streamlit")
# 2. Upload Dataset
upload = st.file_uploader("Upload your data set (CSV formate)")
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
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"):
fig, ax = plt.subplots()
sns.heatmap(data.isnull(), ax=ax)
st.pyplot(fig)
else:
st.success("Congratulation!!!, 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")
# 8. Get overall statistics
if upload is not None:
if st.checkbox("Summary of the dataset"):
st.write(data.describe())
# 9. About section
if st.button("About App"):
st.text("Built with streamli")
st.text("Thanks to streamlit")
# 10. End
if st.checkbox("END"):
st.success("Thanks for using Streamlit")