ProfessorLeVesseur
commited on
Commit
•
d234974
1
Parent(s):
6808b16
Update app.py
Browse files
app.py
CHANGED
@@ -130,7 +130,7 @@ ENGAGED_STR = 'Engaged (Respect, Responsibility, Effort)'
|
|
130 |
PARTIALLY_ENGAGED_STR = 'Partially Engaged (about 50%)'
|
131 |
NOT_ENGAGED_STR = 'Not Engaged (less than 50%)'
|
132 |
|
133 |
-
def safe_convert_to_time(series, format_str=
|
134 |
try:
|
135 |
# Attempt to convert to time, ignoring errors
|
136 |
converted = pd.to_datetime(series, errors='coerce').dt.time
|
@@ -384,11 +384,22 @@ def plot_student_metrics(student_metrics_df):
|
|
384 |
bar_width = 0.4
|
385 |
index = range(len(student_metrics_df))
|
386 |
|
387 |
-
# Plot Attendance and Engagement bars
|
388 |
-
ax.bar(
|
389 |
-
|
390 |
-
ax.bar(
|
391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
|
393 |
# Set labels, title, and legend
|
394 |
ax.set_xlabel('Student')
|
|
|
130 |
PARTIALLY_ENGAGED_STR = 'Partially Engaged (about 50%)'
|
131 |
NOT_ENGAGED_STR = 'Not Engaged (less than 50%)'
|
132 |
|
133 |
+
def safe_convert_to_time(series, format_str='%I:%M %p'):
|
134 |
try:
|
135 |
# Attempt to convert to time, ignoring errors
|
136 |
converted = pd.to_datetime(series, errors='coerce').dt.time
|
|
|
384 |
bar_width = 0.4
|
385 |
index = range(len(student_metrics_df))
|
386 |
|
387 |
+
# Plot Attendance and Engagement bars with different widths for overlapping
|
388 |
+
attendance_bars = ax.bar(index, student_metrics_df['Attendance (%)'],
|
389 |
+
width=bar_width, label='Attendance (%)', color='#005288', alpha=0.7)
|
390 |
+
engagement_bars = ax.bar(index, student_metrics_df['Engagement (%)'],
|
391 |
+
width=bar_width / 2, label='Engagement (%)', color='#3AB0FF', alpha=0.7)
|
392 |
+
|
393 |
+
# Add values to each bar
|
394 |
+
for bar in attendance_bars:
|
395 |
+
height = bar.get_height()
|
396 |
+
ax.text(bar.get_x() + bar.get_width() / 2, height, f'{height:.1f}%',
|
397 |
+
ha='center', va='bottom', color='black')
|
398 |
+
|
399 |
+
for bar in engagement_bars:
|
400 |
+
height = bar.get_height()
|
401 |
+
ax.text(bar.get_x() + bar.get_width() / 2, height, f'{height:.1f}%',
|
402 |
+
ha='center', va='bottom', color='black')
|
403 |
|
404 |
# Set labels, title, and legend
|
405 |
ax.set_xlabel('Student')
|