mdidwan2 commited on
Commit
59ae744
1 Parent(s): 0ca1efa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ # Define two example datasets
5
+ hospitals = [
6
+ {'City': 'New York', 'State': 'NY', 'Beds': 2000},
7
+ {'City': 'Los Angeles', 'State': 'CA', 'Beds': 1500},
8
+ {'City': 'Chicago', 'State': 'IL', 'Beds': 1200},
9
+ {'City': 'Houston', 'State': 'TX', 'Beds': 1800},
10
+ {'City': 'Phoenix', 'State': 'AZ', 'Beds': 1300}
11
+ ]
12
+
13
+ populations = [
14
+ {'State': 'NY', 'Population': 19530000, 'SquareMiles': 54555},
15
+ {'State': 'CA', 'Population': 39540000, 'SquareMiles': 163696},
16
+ {'State': 'IL', 'Population': 12670000, 'SquareMiles': 57914},
17
+ {'State': 'TX', 'Population': 29150000, 'SquareMiles': 268596},
18
+ {'State': 'AZ', 'Population': 7279000, 'SquareMiles': 113990}
19
+ ]
20
+
21
+ # Merge the datasets based on the state column
22
+ df = pd.merge(pd.DataFrame(hospitals), pd.DataFrame(populations), on='State')
23
+
24
+ # Filter the merged dataset to include only hospitals with over 1000 beds
25
+ df = df[df['Beds'] > 1000]
26
+
27
+ # Calculate the number of beds per square mile for each state
28
+ df['BedsPerSquareMile'] = df['Beds'] / df['SquareMiles']
29
+
30
+ # Display the resulting dataframe in Streamlit
31
+ st.write(df)