Karlsen's picture
Update app.py
c48d292 verified
raw
history blame contribute delete
No virus
988 Bytes
!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.