File size: 988 Bytes
c48d292 |
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 |
!pip install streamlit
!pip install pandas
!pip install numpy
import streamlit as st
import pandas as pd
import numpy as np
# Load your DataFrame here
df = pd.read_csv("TIMES_WorldUniversityRankings_2024.csv")
# Streamlit app
st.title('University Data portal')
# Search bar logic
search_type = st.radio("Choose your search type:", ('University', 'Country'))
if search_type == 'University':
university_name = st.selectbox('Select University', df['name'].unique())
selected_uni = df[df['name'] == university_name]
if not selected_uni.empty:
st.write(selected_uni)
else:
country_name = st.selectbox('Select Country', df['location'].unique())
selected_country = df[df['location'] == country_name]
if not selected_country.empty:
st.write(selected_country[['name', 'scores_teaching', 'scores_research', 'scores_citations']])
# To run this Streamlit app, save this script and run it using `streamlit run your_script_name.py` from your terminal. |