Skip to content

Commit 10bea3e

Browse files
Add logic to remove timetable dates when the current date is before the start date
1 parent b08a2a3 commit 10bea3e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cfrr_program_details/courses_overview.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 1,
13+
"execution_count": 13,
1414
"id": "d3aa7606-0f50-4f05-b104-ad4521c80406",
1515
"metadata": {
1616
"editable": true,
@@ -25,9 +25,8 @@
2525
{
2626
"data": {
2727
"text/markdown": [
28-
"- Python for Data Analysis: 29th November/6th December 10am-1pm (In-person only) - [MS Form Signup](https://forms.office.com/e/ChUMbgntbr)\n",
29-
"- Regression Analysis with R: 25th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UMU1KRUpEOFRJQjFEOVVUVzFDMTRQMFZLRi4u)\n",
30-
"- Working with Data in R: 18th/25th November 1-4pm (online only) - [MS Form Signup](https://forms.office.com/e/zi5g1uP5sB)"
28+
"- Introduction to Python: 17th/24th January 2025 10am-1pm (In-person only) - [MS Form Signup](https://forms.office.com/e/YAxvuE5dG5)\n",
29+
"- Python for Data Analysis: 6th/13th February 2025 1-4pm (Online only) - [MS Form Signup](https://forms.office.com/e/rJRBxYnxKA)"
3130
],
3231
"text/plain": [
3332
"<IPython.core.display.Markdown object>"
@@ -51,13 +50,16 @@
5150
"\n",
5251
"# Convert the 'End Date' column to datetime (assuming the date format is day-first)\n",
5352
"courses_df['End Date'] = pd.to_datetime(courses_df['End Date'], dayfirst=True, errors='coerce')\n",
53+
"courses_df['Start Date'] = pd.to_datetime(courses_df['Start Date'], dayfirst=True, errors='coerce')\n",
5454
"\n",
5555
"# Get today's date\n",
5656
"today = datetime.now()\n",
5757
"\n",
5858
"# Filter for rows that contain valid MS Form Signup links, Course Date information, and check if the 'End Date' is still valid\n",
5959
"filtered_courses_df = courses_df.dropna(subset=['Course Date', 'MS Form Signup'])\n",
6060
"filtered_courses_df = filtered_courses_df[filtered_courses_df['End Date'] > today]\n",
61+
"filtered_courses_df = filtered_courses_df[filtered_courses_df['Start Date'] <= today]\n",
62+
"\n",
6163
"\n",
6264
"# Function to generate markdown text based on course details\n",
6365
"def generate_markdown(row):\n",

0 commit comments

Comments
 (0)