Spaces:
Runtime error
Runtime error
File size: 1,176 Bytes
368b910 e30b335 368b910 |
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 |
import pandas as pd
import streamlit as st
import plotly.express as px
st.set_page_config('Dashboard',':bar_chart:',layout='wide')
#st.title=(':bar_chart: Sales Dashboard')
#st.markdown('##')
df= pd.read_excel(
io='pd1.xlsx',
#sheet_name='Ark1',
#skiprows=3,
#usecols='A,C:F',
#nrows=10,
)
#st.dataframe(df)
st.sidebar.header('Please filter here')
city=st.sidebar.multiselect('Select the City:',df['City'].unique(),default=df['City'].unique())
customer_type=st.sidebar.multiselect('Select the customer type:',df['Customer_type'].unique(),default=df['Customer_type'].unique())
gender=st.sidebar.multiselect('Select the Gender:',df['Gender'].unique(),default=df['Gender'].unique())
#Filter
df_selection = df.query(
"City == @city & Customer_type == @customer_type & Gender == @gender"
)
st.dataframe(df_selection)
total=int(df_selection['Total'].sum())
rating=round(df_selection['Rating'].mean(),1)
star=":star:" * int(round(rating,0))
lc,rc =st.columns(2)
with lc:
st.subheader('Total Sales:')
st.subheader(f'$ {total:,}')
with rc:
st.subheader('Average Rating:')
st.subheader(f'{rating} {star}')
st.markdown('---')
|