Update app.py
Browse files
app.py
CHANGED
|
@@ -397,22 +397,10 @@ def compute_student_metrics(df):
|
|
| 397 |
'Absent (%)': absent_pct
|
| 398 |
}
|
| 399 |
|
| 400 |
-
# # Create a DataFrame from student_metrics
|
| 401 |
-
# student_metrics_df = pd.DataFrame.from_dict(student_metrics, orient='index').reset_index()
|
| 402 |
-
# student_metrics_df.rename(columns={'index': 'Student'}, inplace=True)
|
| 403 |
-
# return student_metrics_df
|
| 404 |
-
|
| 405 |
# Create a DataFrame from student_metrics
|
| 406 |
student_metrics_df = pd.DataFrame.from_dict(student_metrics, orient='index').reset_index()
|
| 407 |
student_metrics_df.rename(columns={'index': 'Student'}, inplace=True)
|
| 408 |
-
|
| 409 |
-
# Use Pandas styler to bold specific columns and then export to HTML
|
| 410 |
-
styled_df = student_metrics_df.style \
|
| 411 |
-
.set_properties(**{'font-weight': 'bold'}, subset=pd.IndexSlice[:, ['Student', 'Attendance (%)', 'Engagement (%)']]) \
|
| 412 |
-
.set_table_styles([{'selector': 'th.colheading', 'props': [('font-weight', 'bold')]}], overwrite=False)
|
| 413 |
-
|
| 414 |
-
# Return the styled DataFrame as an HTML string
|
| 415 |
-
return styled_df.to_html()
|
| 416 |
|
| 417 |
def plot_student_metrics(student_metrics_df):
|
| 418 |
# Create the figure and axis
|
|
|
|
| 397 |
'Absent (%)': absent_pct
|
| 398 |
}
|
| 399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
# Create a DataFrame from student_metrics
|
| 401 |
student_metrics_df = pd.DataFrame.from_dict(student_metrics, orient='index').reset_index()
|
| 402 |
student_metrics_df.rename(columns={'index': 'Student'}, inplace=True)
|
| 403 |
+
return student_metrics_df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
|
| 405 |
def plot_student_metrics(student_metrics_df):
|
| 406 |
# Create the figure and axis
|