Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -259,8 +259,25 @@ if not df_final.empty and source_choice == "(All)":
|
|
| 259 |
)
|
| 260 |
|
| 261 |
# ------------------- Output -------------------
|
| 262 |
-
fig = plot_radar(df_final, grouped, chart_title)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
| 264 |
st.caption(f"{len(df_final)} line(s) aggregated." if not df_final.empty else "No data.")
|
| 265 |
|
| 266 |
# ================== Dynamic Stage Summaries (only if student answered that week) ==================
|
|
|
|
| 259 |
)
|
| 260 |
|
| 261 |
# ------------------- Output -------------------
|
| 262 |
+
# fig = plot_radar(df_final, grouped, chart_title)
|
| 263 |
+
# st.plotly_chart(fig, use_container_width=True)
|
| 264 |
+
df_plot = df_final.copy()
|
| 265 |
+
avg_label = None
|
| 266 |
+
|
| 267 |
+
if not df_plot.empty:
|
| 268 |
+
cols = list(SKILL_GROUPS.keys()) if grouped else SKILLS
|
| 269 |
+
show_cohort_avg = st.toggle("Show cohort average (all students)", value=True)
|
| 270 |
+
|
| 271 |
+
if show_cohort_avg:
|
| 272 |
+
avg_vals = df_plot[cols].mean()
|
| 273 |
+
avg_row = {"label": "Average (All Students)"}
|
| 274 |
+
avg_row.update({k: float(avg_vals[k]) for k in cols})
|
| 275 |
+
df_plot = pd.concat([df_plot, pd.DataFrame([avg_row])], ignore_index=True)
|
| 276 |
+
avg_label = "Average (All Students)"
|
| 277 |
+
|
| 278 |
+
fig = plot_radar(df_plot, grouped, chart_title, avg_label=avg_label)
|
| 279 |
st.plotly_chart(fig, use_container_width=True)
|
| 280 |
+
|
| 281 |
st.caption(f"{len(df_final)} line(s) aggregated." if not df_final.empty else "No data.")
|
| 282 |
|
| 283 |
# ================== Dynamic Stage Summaries (only if student answered that week) ==================
|