hhalim commited on
Commit
56d2707
1 Parent(s): 104fb79

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ import pandas as pd
4
+ import numpy as np
5
+
6
+ # Create two datasets
7
+ hospitals_list = [{"City":"New York","State": "NY","Bed Count":1200},{"City":"Los Angeles","State":"CA","Bed Count":1400},{"City":"Chicago","State":"IL","Bed Count":1650}]
8
+
9
+ state_data = [{"State":"NY","Population": 8.5e6,"Square Miles": 54.556},{"State":"CA","Population": 39.25e6,"Square Miles": 163.696},{"State":"IL","Population": 12.8e6,"Square Miles": 57.914}]
10
+
11
+ # Create dataframes from the datasets
12
+ hospitals_df = pd.DataFrame(hospitals_list)
13
+ state_df = pd.DataFrame(state_data)
14
+
15
+ # Merge the two datasets together
16
+ merged_df = pd.merge(hospitals_df, state_df, on="State")
17
+
18
+ # Display the merged dataset
19
+ st.write("Merged Dataset")
20
+ st.write(merged_df)
21
+
22
+ # Calculate average beds per square mile
23
+ st.write("Calculated Function")
24
+ st.write(merged_df.loc[:,"Bed Count"]/merged_df.loc[:,"Square Miles"])