awacke1 commited on
Commit
d21eb79
·
1 Parent(s): 211eda9

Create backupapp.py

Browse files
Files changed (1) hide show
  1. backupapp.py +36 -0
backupapp.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import plotly.express as px
3
+ import pandas as pd
4
+
5
+ # Define the states and conditions of interest
6
+ states = ["Minnesota", "Florida", "California"]
7
+ top_n = 10
8
+
9
+ # Define the list dictionary of top 10 health conditions descending by cost
10
+ health_conditions = [
11
+ {"condition": "Heart disease", "spending": 214.3},
12
+ {"condition": "Trauma-related disorders", "spending": 198.6},
13
+ {"condition": "Cancer", "spending": 171.0},
14
+ {"condition": "Mental disorders", "spending": 150.8},
15
+ {"condition": "Osteoarthritis and joint disorders", "spending": 142.4},
16
+ {"condition": "Diabetes", "spending": 107.4},
17
+ {"condition": "Chronic obstructive pulmonary disease and asthma", "spending": 91.0},
18
+ {"condition": "Hypertension", "spending": 83.9},
19
+ {"condition": "Hyperlipidemia", "spending": 83.9},
20
+ {"condition": "Back problems", "spending": 67.0}
21
+ ]
22
+
23
+ # Total the spending values
24
+ total_spending = sum([hc["spending"] for hc in health_conditions])
25
+
26
+ # Create a DataFrame from the list dictionary
27
+ df_top_conditions = pd.DataFrame(health_conditions)
28
+
29
+ # Create the treemap graph using Plotly Express
30
+ fig = px.treemap(df_top_conditions, path=["condition"], values="spending")
31
+
32
+ # Set the title of the graph
33
+ fig.update_layout(title=f"Top {top_n} Health Conditions in {', '.join(states)} by Spending (Total: ${total_spending}B)")
34
+
35
+ # Display the graph in Streamlit
36
+ st.plotly_chart(fig)