ProfessorLeVesseur commited on
Commit
745f815
1 Parent(s): b0c1d78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -144,6 +144,8 @@ def main():
144
  # Format "Date of Session" and "Timestamp"
145
  df['Date of Session'] = pd.to_datetime(df['Date of Session']).dt.strftime('%m/%d/%Y')
146
  df['Timestamp'] = pd.to_datetime(df['Timestamp']).dt.strftime('%I:%M %p')
 
 
147
  df = df[['Date of Session', 'Timestamp'] + [col for col in df.columns if col not in ['Date of Session', 'Timestamp']]]
148
 
149
  # Replace student names with initials
@@ -174,7 +176,7 @@ def main():
174
  with col2:
175
  intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
176
  # Display the "Intervention Frequency (%)" text
177
- st.markdown("<h2 style='color: #358E66;'>Intervention Frequency (%)</h2>", unsafe_allow_html=True)
178
  # Display the frequency value below it
179
  st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
180
 
@@ -343,13 +345,15 @@ def compute_student_metrics(df):
343
  return student_metrics_df
344
 
345
  def plot_student_metrics(student_metrics_df):
346
- # Create a line graph for attendance and engagement
347
  fig, ax = plt.subplots()
348
 
349
- # Plotting Attendance and Engagement with specific colors
350
- ax.plot(student_metrics_df['Student'], student_metrics_df['Attendance (%)'], marker='o', color='#005288', label='Attendance (%)')
351
- ax.plot(student_metrics_df['Student'], student_metrics_df['Engagement (%)'], marker='o', color='#3AB0FF', label='Engagement (%)')
 
352
 
 
353
  ax.set_xlabel('Student')
354
  ax.set_ylabel('Percentage (%)')
355
  ax.set_title('Student Attendance and Engagement Metrics')
 
144
  # Format "Date of Session" and "Timestamp"
145
  df['Date of Session'] = pd.to_datetime(df['Date of Session']).dt.strftime('%m/%d/%Y')
146
  df['Timestamp'] = pd.to_datetime(df['Timestamp']).dt.strftime('%I:%M %p')
147
+ df['Session Start Time'] = pd.to_datetime(df['Session Start Time']).dt.strftime('%I:%M %p')
148
+ df['Session End Time'] = pd.to_datetime(df['Session End Time']).dt.strftime('%I:%M %p')
149
  df = df[['Date of Session', 'Timestamp'] + [col for col in df.columns if col not in ['Date of Session', 'Timestamp']]]
150
 
151
  # Replace student names with initials
 
176
  with col2:
177
  intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
178
  # Display the "Intervention Frequency (%)" text
179
+ st.markdown("<h2 style='color: #358E66;'>Intervention Frequency</h2>", unsafe_allow_html=True)
180
  # Display the frequency value below it
181
  st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
182
 
 
345
  return student_metrics_df
346
 
347
  def plot_student_metrics(student_metrics_df):
348
+ # Create a stacked bar chart for attendance and engagement
349
  fig, ax = plt.subplots()
350
 
351
+ # Plotting the Attendance and Engagement as stacked bars
352
+ ax.bar(student_metrics_df['Student'], student_metrics_df['Attendance (%)'], label='Attendance (%)', color='#005288')
353
+ ax.bar(student_metrics_df['Student'], student_metrics_df['Engagement (%)'],
354
+ bottom=student_metrics_df['Attendance (%)'], label='Engagement (%)', color='#3AB0FF')
355
 
356
+ # Setting the labels, title, and legend
357
  ax.set_xlabel('Student')
358
  ax.set_ylabel('Percentage (%)')
359
  ax.set_title('Student Attendance and Engagement Metrics')