dvaz commited on
Commit
368b910
·
1 Parent(s): 1c68e67

Upload pd.py

Browse files
Files changed (1) hide show
  1. pages/pd.py +54 -0
pages/pd.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import streamlit as st
3
+ import plotly.express as px
4
+
5
+
6
+ st.set_page_config('Dashboard',':bar_chart:',layout='wide')
7
+
8
+ st.title=(':bar_chart: Sales Dashboard')
9
+ #st.markdown('##')
10
+
11
+ df= pd.read_excel(
12
+ io='pd1.xlsx',
13
+ #sheet_name='Ark1',
14
+ #skiprows=3,
15
+ #usecols='A,C:F',
16
+ #nrows=10,
17
+ )
18
+
19
+
20
+ #st.dataframe(df)
21
+
22
+
23
+ st.sidebar.header('Please filter here')
24
+
25
+
26
+ city=st.sidebar.multiselect('Select the City:',df['City'].unique(),default=df['City'].unique())
27
+
28
+ customer_type=st.sidebar.multiselect('Select the customer type:',df['Customer_type'].unique(),default=df['Customer_type'].unique())
29
+
30
+ gender=st.sidebar.multiselect('Select the Gender:',df['Gender'].unique(),default=df['Gender'].unique())
31
+
32
+ #Filter
33
+ df_selection = df.query(
34
+ "City == @city & Customer_type == @customer_type & Gender == @gender"
35
+ )
36
+
37
+ st.dataframe(df_selection)
38
+
39
+
40
+ total=int(df_selection['Total'].sum())
41
+ rating=round(df_selection['Rating'].mean(),1)
42
+ star=":star:" * int(round(rating,0))
43
+
44
+ lc,rc =st.columns(2)
45
+
46
+ with lc:
47
+ st.subheader('Total Sales:')
48
+ st.subheader(f'$ {total:,}')
49
+
50
+ with rc:
51
+ st.subheader('Average Rating:')
52
+ st.subheader(f'{rating} {star}')
53
+
54
+ st.markdown('---')