Spaces:
Sleeping
Sleeping
File size: 1,435 Bytes
d6f3a04 |
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 |
import streamlit as st
import pandas as pd
# Load the data
data = pd.read_csv('Exact_Match_Updated_Authors_Data.csv')
# Display the title
st.title("Data Filter:")
# Sidebar filters with "All" option
country_options = ['All'] + list(data['country'].unique())
selected_country = st.sidebar.selectbox('Select Country', country_options)
# Filter by selected country
if selected_country != 'All':
filtered_data = data[data['country'] == selected_country]
else:
filtered_data = data
# Further filter by university
university_options = ['All'] + list(filtered_data['university'].unique())
selected_university = st.sidebar.selectbox('Select University', university_options)
if selected_university != 'All':
filtered_data = filtered_data[filtered_data['university'] == selected_university]
# Further filter by department
department_options = ['All'] + list(filtered_data['department'].unique())
selected_department = st.sidebar.selectbox('Select Department', department_options)
if selected_department != 'All':
filtered_data = filtered_data[filtered_data['department'] == selected_department]
# Further filter by year
year_options = ['All'] + list(filtered_data['year'].unique())
selected_year = st.sidebar.selectbox('Select Year', year_options)
if selected_year != 'All':
filtered_data = filtered_data[filtered_data['year'] == selected_year]
# Display the filtered data
st.write("Filtered Data", filtered_data)
|