Update main.py
Browse files
main.py
CHANGED
|
@@ -38,6 +38,24 @@ def main():
|
|
| 38 |
# Replace student names with initials
|
| 39 |
df = data_processor.replace_student_names_with_initials(df)
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
st.subheader("Uploaded Data")
|
| 42 |
st.write(df)
|
| 43 |
|
|
|
|
| 38 |
# Replace student names with initials
|
| 39 |
df = data_processor.replace_student_names_with_initials(df)
|
| 40 |
|
| 41 |
+
# Date selection option
|
| 42 |
+
date_option = st.radio(
|
| 43 |
+
"Select data range:",
|
| 44 |
+
("All Data", "Date Range")
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
if date_option == "Date Range":
|
| 48 |
+
# Get the min and max dates from the data
|
| 49 |
+
min_date = df['Date of Session'].min()
|
| 50 |
+
max_date = df['Date of Session'].max()
|
| 51 |
+
|
| 52 |
+
# Date input for start and end date
|
| 53 |
+
start_date = st.date_input("Start Date", min_value=min_date, max_value=max_date, value=min_date)
|
| 54 |
+
end_date = st.date_input("End Date", min_value=min_date, max_value=max_date, value=max_date)
|
| 55 |
+
|
| 56 |
+
# Filter the DataFrame based on the selected date range
|
| 57 |
+
df = df[(df['Date of Session'] >= pd.to_datetime(start_date)) & (df['Date of Session'] <= pd.to_datetime(end_date))]
|
| 58 |
+
|
| 59 |
st.subheader("Uploaded Data")
|
| 60 |
st.write(df)
|
| 61 |
|