Karlsen commited on
Commit
c48d292
1 Parent(s): dc5f6fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py CHANGED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install streamlit
2
+ !pip install pandas
3
+ !pip install numpy
4
+
5
+ import streamlit as st
6
+ import pandas as pd
7
+ import numpy as np
8
+
9
+
10
+ # Load your DataFrame here
11
+
12
+ df = pd.read_csv("TIMES_WorldUniversityRankings_2024.csv")
13
+
14
+
15
+ # Streamlit app
16
+ st.title('University Data portal')
17
+
18
+ # Search bar logic
19
+ search_type = st.radio("Choose your search type:", ('University', 'Country'))
20
+
21
+ if search_type == 'University':
22
+ university_name = st.selectbox('Select University', df['name'].unique())
23
+ selected_uni = df[df['name'] == university_name]
24
+ if not selected_uni.empty:
25
+ st.write(selected_uni)
26
+ else:
27
+ country_name = st.selectbox('Select Country', df['location'].unique())
28
+ selected_country = df[df['location'] == country_name]
29
+ if not selected_country.empty:
30
+ st.write(selected_country[['name', 'scores_teaching', 'scores_research', 'scores_citations']])
31
+
32
+ # To run this Streamlit app, save this script and run it using `streamlit run your_script_name.py` from your terminal.