leavoigt commited on
Commit
42d7457
1 Parent(s): ccc6bed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -17
app.py CHANGED
@@ -108,29 +108,25 @@ if 'key0' in st.session_state:
108
  # Pie chart
109
  with col1:
110
 
111
- st.write(type(st.session_state['key0']))
112
- st.write(st.session_state['key0'])
113
  # Create a df that stores how often the labels appear
114
  df_count = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
115
 
116
- # # Count how often each label appears in the "Vulnerability Labels" column
117
- # label_counts = st.session_state['key0']['Vulnerability Labels'].value_counts().reset_index()
118
- # label_counts.columns = ['Label', 'Count']
119
 
120
- # # Merge the label counts with the df_label DataFrame
121
- # df_label = df_label.merge(label_counts, on='Label', how='left')
122
- # st.write(df_label)
123
- #bar_data = st.session_state['key0']
124
-
125
 
126
- # fig = px.bar(st.session_state['key0'],
127
- # x="Year",
128
- # y="Value",
129
  # color='Country',
130
- # title='Chart 3 - Total Population',
131
- # hover_name="Value",
132
- # color_discrete_sequence=px.colors.qualitative.Plotly
133
- # )
134
 
135
 
136
 
 
108
  # Pie chart
109
  with col1:
110
 
 
 
111
  # Create a df that stores how often the labels appear
112
  df_count = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
113
 
114
+ # Count how often each label appears in the "Vulnerability Labels" column
115
+ label_counts = st.session_state['key0']['Vulnerability Label'].value_counts().reset_index()
116
+ label_counts.columns = ['Label', 'Count']
117
 
118
+ # Merge the label counts with the df_label DataFrame
119
+ df_label = df_label.merge(label_counts, on='Label', how='left')
120
+
 
 
121
 
122
+ fig = px.bar(df_label,
123
+ x="Label",
124
+ y="Count",
125
  # color='Country',
126
+ title='Label Count',
127
+ hover_name="Value",
128
+ color_discrete_sequence=px.colors.qualitative.Plotly
129
+ )
130
 
131
 
132