DavMelchi commited on
Commit
8e6b5cf
·
1 Parent(s): b89c5d7

Improve GSM capacity charts

Browse files
Files changed (1) hide show
  1. apps/kpi_analysis/gsm_capacity.py +81 -17
apps/kpi_analysis/gsm_capacity.py CHANGED
@@ -137,7 +137,12 @@ if (
137
  final_comments_df = (
138
  gsm_analysis_df.groupby("Final comment").size().reset_index(name="count")
139
  )
140
- fig = px.bar(final_comments_df, x="Final comment", y="count")
 
 
 
 
 
141
  fig.update_layout(height=1000)
142
  fig.update_traces(texttemplate="%{value}", textposition="outside")
143
  st.plotly_chart(fig, use_container_width=True)
@@ -149,31 +154,90 @@ if (
149
  .size()
150
  .reset_index(name="count")
151
  )
152
- fig = px.bar(final_comments_summary_df, x="Final comment summary", y="count")
153
- fig.update_layout(height=1000)
154
- fig.update_traces(texttemplate="%{value}", textposition="outside")
155
- st.plotly_chart(fig, use_container_width=True)
156
- st.write(final_comments_summary_df)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
  # Add dataframe and ploty bar chart with "BH Congestion status" distribution in gsm_analysis_df in 2 columns
 
 
159
  bh_congestion_status_df = (
160
  gsm_analysis_df.groupby("BH Congestion status")
161
  .size()
162
  .reset_index(name="count")
163
  )
164
- fig = px.bar(bh_congestion_status_df, x="BH Congestion status", y="count")
165
- fig.update_layout(height=800)
166
- fig.update_traces(texttemplate="%{value}", textposition="outside")
167
- st.plotly_chart(fig, use_container_width=True)
168
- st.write(bh_congestion_status_df)
169
- # Add dataframe and ploty bar chart with "operational_comment" distribution in gsm_analysis_df in 2 columns
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  operational_comments_df = (
171
  gsm_analysis_df.groupby("operational_comment")
172
  .size()
173
  .reset_index(name="count")
174
  )
175
- fig = px.bar(operational_comments_df, x="operational_comment", y="count")
176
- fig.update_layout(height=600)
177
- fig.update_traces(texttemplate="%{value}", textposition="outside")
178
- st.plotly_chart(fig, use_container_width=True)
179
- st.write(operational_comments_df)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  final_comments_df = (
138
  gsm_analysis_df.groupby("Final comment").size().reset_index(name="count")
139
  )
140
+ fig = px.bar(
141
+ final_comments_df,
142
+ x="Final comment",
143
+ y="count",
144
+ title="Final comment distribution",
145
+ )
146
  fig.update_layout(height=1000)
147
  fig.update_traces(texttemplate="%{value}", textposition="outside")
148
  st.plotly_chart(fig, use_container_width=True)
 
154
  .size()
155
  .reset_index(name="count")
156
  )
157
+ # Add Pie chart with "Final comment summary" distribution in gsm_analysis_df in 2 columns
158
+ st.markdown("***")
159
+ st.markdown(":blue[**Final comment summary distribution**]")
160
+ final_comments_summary_col1, final_comments_summary_col2 = st.columns((1, 3))
161
+ with final_comments_summary_col1:
162
+ st.write(final_comments_summary_df)
163
+ with final_comments_summary_col2:
164
+ fig = px.pie(
165
+ final_comments_summary_df,
166
+ names="Final comment summary",
167
+ values="count",
168
+ hover_name="Final comment summary",
169
+ hover_data=["count"],
170
+ title="GSM Analysis comment distribution",
171
+ )
172
+ fig.update_layout(height=800)
173
+ fig.update_traces(
174
+ texttemplate="%{label}: %{value}",
175
+ textfont_size=15,
176
+ textposition="outside",
177
+ )
178
+ st.plotly_chart(fig, use_container_width=True)
179
 
180
  # Add dataframe and ploty bar chart with "BH Congestion status" distribution in gsm_analysis_df in 2 columns
181
+ st.markdown("***")
182
+ st.markdown(":blue[**BH Congestion status distribution**]")
183
  bh_congestion_status_df = (
184
  gsm_analysis_df.groupby("BH Congestion status")
185
  .size()
186
  .reset_index(name="count")
187
  )
188
+ # Replace "" cell in "BH Congestion status" with "No Congestion"
189
+ bh_congestion_status_df["BH Congestion status"] = bh_congestion_status_df[
190
+ "BH Congestion status"
191
+ ].replace("", "No Congestion")
192
+ # Replace "nan, nan" cell in "BH Congestion status" with "No KPI"
193
+ bh_congestion_status_df["BH Congestion status"] = bh_congestion_status_df[
194
+ "BH Congestion status"
195
+ ].replace("nan, nan", "No KPI")
196
+
197
+ bh_congestion_status_col1, bh_congestion_status_col2 = st.columns((2, 1))
198
+ with bh_congestion_status_col2:
199
+ st.write(bh_congestion_status_df)
200
+ with bh_congestion_status_col1:
201
+ fig = px.pie(
202
+ bh_congestion_status_df,
203
+ names="BH Congestion status",
204
+ values="count",
205
+ hover_name="BH Congestion status",
206
+ hover_data=["count"],
207
+ title="BH Congestion status distribution",
208
+ )
209
+ fig.update_layout(height=800)
210
+ fig.update_traces(
211
+ texttemplate="%{label}: %{value}",
212
+ textfont_size=15,
213
+ textposition="outside",
214
+ )
215
+ st.plotly_chart(fig, use_container_width=True)
216
+
217
+ # Add dataframe and ploty pie chart with "operational_comment" distribution in gsm_analysis_df in 2 columns
218
+ st.markdown("***")
219
+ st.markdown(":blue[**Operational comments distribution**]")
220
  operational_comments_df = (
221
  gsm_analysis_df.groupby("operational_comment")
222
  .size()
223
  .reset_index(name="count")
224
  )
225
+ operational_comments_col1, operational_comments_col2 = st.columns((1, 2))
226
+ with operational_comments_col1:
227
+ st.write(operational_comments_df)
228
+ with operational_comments_col2:
229
+ fig = px.pie(
230
+ operational_comments_df,
231
+ names="operational_comment",
232
+ values="count",
233
+ hover_name="operational_comment",
234
+ hover_data=["count"],
235
+ title="Operational comments distribution",
236
+ )
237
+ fig.update_layout(height=600)
238
+ fig.update_traces(
239
+ texttemplate="%{label}: %{value}",
240
+ textfont_size=15,
241
+ textposition="outside",
242
+ )
243
+ st.plotly_chart(fig, use_container_width=True)