Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7a028cd

Browse files
Add files via upload
1 parent 5f61346 commit 7a028cd

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

‎Streamlit/EDAapp.py‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# importing the libraries
2+
import numpy as np
3+
import pandas as pd
4+
import matplotlib.pyplot as plt
5+
import plotly.express as px
6+
import streamlit as st
7+
8+
# Title and Markdown
9+
st.title("AN EXAMPLE EDA APP")
10+
st.markdown(''' <h3>This is an example of how to do EDA in streamlit app</h3>''',unsafe_allow_html=True)
11+
12+
# File upload
13+
file_up = st.file_uploader("Upload a file", type='csv')
14+
15+
# Check if the file uploaded is successfull or not, if successfull then read the file
16+
if file_up is not None:
17+
st.success("File uploaded successfully")
18+
df = pd.read_csv(file_up)
19+
obj = []
20+
int_float = []
21+
for i in df.columns:
22+
clas = df[i].dtypes
23+
if clas == 'object':
24+
obj.append(i)
25+
else:
26+
int_float.append(i)
27+
28+
# Remove null values and replace them with mean and median value
29+
with st.form(key='my_form'):
30+
with st.sidebar:
31+
st.sidebar.header("To remove NULL values press below button")
32+
submit_button = st.form_submit_button(label="Remove NULL")
33+
34+
if submit_button:
35+
for i in df.columns:
36+
clas = df[i].dtypes
37+
if clas == 'object':
38+
df[i].fillna(df[i].mode()[0], inplace = True)
39+
else:
40+
df[i].fillna(df[i].mean(), inplace = True)
41+
42+
# finding the number of null values in each column
43+
ls = []
44+
for i in df.columns:
45+
dd = sum(pd.isnull(df[i]))
46+
ls.append(dd)
47+
48+
# if number of null values are zero it will display some text else it will plot bar plot by each column
49+
if max(ls) == 0:
50+
st.write("Total no. of NULL values: ", str(max(ls)))
51+
else:
52+
st.write("Bar plot to know the number of NULL values in each column")
53+
st.write("Total number of null values: ", str(max(ls)))
54+
fig = px.bar(x=df.columns, y=ls,labels={'x':"Column Names",'y':"No. of Null values"})
55+
st.plotly_chart(fig)
56+
57+
# Frequency Plot
58+
st.sidebar.header("Select variable")
59+
selected = st.sidebar.selectbox('Object variables',obj)
60+
st.write("Bar Plot to know the frequency of each category")
61+
frequency = df[selected].value_counts()
62+
63+
fig2 = px.bar(frequency, x=frequency.index,y=selected,labels={'x':selected, 'y':'count'})
64+
st.plotly_chart(fig2)
65+
66+
# Correlation chart
67+
st.sidebar.header("Select variable")
68+
selected2 = st.sidebar.multiselect("Variables",int_float)
69+
st.write("Scatter plot for correlation")
70+
if len(selected2) == 2:
71+
fig3 = px.scatter(df,x=selected2[0], y=selected2[1])
72+
st.plotly_chart(fig3)
73+
else:
74+
st.write("Select any 2 variables only")

‎Streamlit/app5.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# ADDING A LOGO OR IMAGE TO YOUR APP
2+
import streamlit as st
3+
import pandas as pd
4+
from PIL import Image
5+
6+
st.header("ADDING A LOGO OR IMAGE TO YOUR APP")
7+
8+
image1 = Image.open("C:\\Users\\mithun\\OneDrive\\Pictures\\1_kgmImYxdhX01Yfk5qzkX-A.jpeg")
9+
image2 = Image.open("C:\\Users\\mithun\\OneDrive\\Pictures\\Saved Pictures\\Logo.png")
10+
st.image(image1, width=500)
11+
st.image(image2, width=500)
12+
13+
# creating a button for uploading the files
14+
file_up = st.file_uploader("Upload a file", type='csv') # Display a file uploader widget. By default, uploaded files are limited to 200MB
15+
st.write(pd.DataFrame(file_up).head())

‎Streamlit/app6.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SUBMIT BUTTON, SELECTION BUTTON AND SLIDERS
2+
from cProfile import label
3+
import pandas as pd
4+
import streamlit as st
5+
6+
# select box/ drop down menu
7+
specalization = st.selectbox("Select the Specalization", ["Data Science","Artifical Intelligence","Software Engineering"])
8+
st.write("You have choosen the specalization: ", specalization)
9+
10+
with st.form(key='my_form'):
11+
text_input = st.text_input(label="Enter your name")
12+
submit_button = st.form_submit_button(label='Submit')
13+
14+
with st.form(key='new_form'):
15+
st.selectbox("Select the algorithm",['Logistic','Linear','SVM'], key=1)
16+
st.multiselect("Select the algorithm",['Logistic','Linear','SVM'], key=1)
17+
st.slider(label="Select the knowledge level", min_value=0,max_value=10, key=2)
18+
submit_button = st.form_submit_button(label='Submit')
19+
st.success("Submitted succesfully")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /