khusniania commited on
Commit
6582c0d
1 Parent(s): 6dd6674

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -58
app.py CHANGED
@@ -2,61 +2,4 @@ import pandas as pd
2
  import streamlit as st
3
  import numpy as np
4
 
5
- st.set_page_config(page_title='Survey Results')
6
- st.header('Survey Results')
7
- st.subheader('the results of amount data')
8
-
9
- # load dataframe
10
- excel_file = 'completedcard.xlsx'
11
- sheet_name = 'completedcard'
12
-
13
- df = pd.read_excel(excel_file,
14
- sheet_name=sheet_name,
15
- usecols='A:F',
16
- header=0)
17
-
18
- df_participants = pd.read_excel(excel_file,
19
- sheet_name=sheet_name,
20
- usecols='N:O',
21
- header=0)
22
-
23
- st.dataframe(df)
24
-
25
- pie_chart = px.pie(df_participants,
26
- title='Total Results',
27
- values= 'participant',
28
- names= 'types')
29
-
30
- st.plotly_chart(pie_chart)
31
-
32
- # streamlit selection
33
- tipe = df['type'].unique().tolist()
34
- years = df['year'].unique().tolist()
35
-
36
- year_selection = st.slider('year:',
37
- min_value= min(years),
38
- max_value= max(years),
39
- value=(min(years), max(years)))
40
-
41
- type_selection = st.multiselect('type:',
42
- tipe,
43
- default=tipe)
44
-
45
- # filter selection
46
- mask = (df['year'].between(*year_selection)) & (df['type'].isin(type_selection))
47
- number_of_result = df[mask].shape[0]
48
- st.markdown(f'*The results: {number_of_result}*')
49
-
50
- # group data frame
51
- df_grouped = df[mask].groupby(by=['type']).count()[['year']]
52
-
53
- df_grouped = df_grouped.reset_index()
54
-
55
- # bar chart
56
- bar_chart = px.bar(df_grouped,
57
- x= 'type',
58
- y='year',
59
- text= 'type',
60
- color_discrete_sequence= ['black']*len(df_grouped),
61
- template='plotly_white')
62
- st.plotly_chart(bar_chart)
 
2
  import streamlit as st
3
  import numpy as np
4
 
5
+ st.title('hhhh')