Kiranontimitta commited on
Commit
d6f3a04
·
verified ·
1 Parent(s): 1345d9b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ # Load the data
5
+ data = pd.read_csv('Exact_Match_Updated_Authors_Data.csv')
6
+
7
+ # Display the title
8
+ st.title("Data Filter:")
9
+
10
+ # Sidebar filters with "All" option
11
+ country_options = ['All'] + list(data['country'].unique())
12
+ selected_country = st.sidebar.selectbox('Select Country', country_options)
13
+
14
+ # Filter by selected country
15
+ if selected_country != 'All':
16
+ filtered_data = data[data['country'] == selected_country]
17
+ else:
18
+ filtered_data = data
19
+
20
+ # Further filter by university
21
+ university_options = ['All'] + list(filtered_data['university'].unique())
22
+ selected_university = st.sidebar.selectbox('Select University', university_options)
23
+
24
+ if selected_university != 'All':
25
+ filtered_data = filtered_data[filtered_data['university'] == selected_university]
26
+
27
+ # Further filter by department
28
+ department_options = ['All'] + list(filtered_data['department'].unique())
29
+ selected_department = st.sidebar.selectbox('Select Department', department_options)
30
+
31
+ if selected_department != 'All':
32
+ filtered_data = filtered_data[filtered_data['department'] == selected_department]
33
+
34
+ # Further filter by year
35
+ year_options = ['All'] + list(filtered_data['year'].unique())
36
+ selected_year = st.sidebar.selectbox('Select Year', year_options)
37
+
38
+ if selected_year != 'All':
39
+ filtered_data = filtered_data[filtered_data['year'] == selected_year]
40
+
41
+ # Display the filtered data
42
+ st.write("Filtered Data", filtered_data)