ProfessorLeVesseur commited on
Commit
2a9a9e7
·
verified ·
1 Parent(s): 536bed4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -251,6 +251,7 @@ def compute_intervention_statistics(df):
251
  stats_df = pd.DataFrame(stats)
252
  return stats_df
253
 
 
254
  def plot_intervention_statistics(intervention_stats):
255
  # Create a stacked bar chart for sessions held and not held
256
  sessions_held = intervention_stats['Intervention Sessions Held'].values[0]
@@ -271,7 +272,7 @@ def plot_intervention_statistics(intervention_stats):
271
  st.pyplot(fig)
272
 
273
  return fig
274
-
275
  def compute_student_metrics(df):
276
  # Filter DataFrame for sessions where intervention happened
277
  intervention_df = df[df[INTERVENTION_COLUMN].str.strip().str.lower() == 'yes']
@@ -283,7 +284,8 @@ def compute_student_metrics(df):
283
  student_metrics = {}
284
 
285
  for col in student_columns:
286
- student_name = col.replace('Student Attendance [', '').replace(']', '').strip()
 
287
  # Get the attendance data for the student
288
  student_data = intervention_df[[col]].copy()
289
 
 
251
  stats_df = pd.DataFrame(stats)
252
  return stats_df
253
 
254
+
255
  def plot_intervention_statistics(intervention_stats):
256
  # Create a stacked bar chart for sessions held and not held
257
  sessions_held = intervention_stats['Intervention Sessions Held'].values[0]
 
272
  st.pyplot(fig)
273
 
274
  return fig
275
+
276
  def compute_student_metrics(df):
277
  # Filter DataFrame for sessions where intervention happened
278
  intervention_df = df[df[INTERVENTION_COLUMN].str.strip().str.lower() == 'yes']
 
284
  student_metrics = {}
285
 
286
  for col in student_columns:
287
+ # Extract student name or initials, removing any suffixes added for uniqueness
288
+ student_name = re.match(r'Student Attendance \[(.+?)\]', col).group(1)
289
  # Get the attendance data for the student
290
  student_data = intervention_df[[col]].copy()
291