|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
5 |
| - "id": "e18ae98b-39e0-4d7b-bbf4-1114ffeef96c", |
| 5 | + "id": "02b9e8f5-82ed-460b-af25-9034e538b7b3", |
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 |
| - "# Workshop Schedule and Signup\n", |
| 8 | + "# Workshop Schedule and Signup" |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "code", |
| 13 | + "execution_count": 6, |
| 14 | + "id": "d3aa7606-0f50-4f05-b104-ad4521c80406", |
| 15 | + "metadata": { |
| 16 | + "editable": true, |
| 17 | + "slideshow": { |
| 18 | + "slide_type": "" |
| 19 | + }, |
| 20 | + "tags": [ |
| 21 | + "remove-input" |
| 22 | + ] |
| 23 | + }, |
| 24 | + "outputs": [ |
| 25 | + { |
| 26 | + "data": { |
| 27 | + "text/markdown": [ |
| 28 | + "- Introduction to Python: 23rd/30th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UNDJFN1NaRlk0UkpLNjVDSTM2TlM0NlpPWS4u)\n", |
| 29 | + "- Introduction to R: 8th/15th/22nd October 1-4pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UQjJCSzFWQjNVSldGRFhDUDNXVjdBQjNZSi4u)\n", |
| 30 | + "- Regression Analysis with R: 25th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UMU1KRUpEOFRJQjFEOVVUVzFDMTRQMFZLRi4u)" |
| 31 | + ], |
| 32 | + "text/plain": [ |
| 33 | + "<IPython.core.display.Markdown object>" |
| 34 | + ] |
| 35 | + }, |
| 36 | + "metadata": {}, |
| 37 | + "output_type": "display_data" |
| 38 | + } |
| 39 | + ], |
| 40 | + "source": [ |
| 41 | + "import pandas as pd\n", |
| 42 | + "from IPython.display import Markdown, display\n", |
| 43 | + "from datetime import datetime\n", |
| 44 | + "\n", |
| 45 | + "# Load the CSV file (adjust the file path as needed)\n", |
| 46 | + "file_path = '../data/workshop_info.csv'\n", |
| 47 | + "courses_df = pd.read_csv(file_path)\n", |
| 48 | + "\n", |
| 49 | + "# Strip any extra spaces in the column names\n", |
| 50 | + "courses_df.columns = courses_df.columns.str.strip()\n", |
| 51 | + "\n", |
| 52 | + "# Convert the 'End Date' column to datetime (assuming the date format is day-first)\n", |
| 53 | + "courses_df['End Date'] = pd.to_datetime(courses_df['End Date'], dayfirst=True, errors='coerce')\n", |
9 | 54 | "\n",
|
10 |
| - "- Introduction to R: 8th/15th/22nd October 1-4pm (online only). [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UQjJCSzFWQjNVSldGRFhDUDNXVjdBQjNZSi4u)\n", |
11 |
| - "- Introduction to Python: 23rd/30th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UNDJFN1NaRlk0UkpLNjVDSTM2TlM0NlpPWS4u)\n", |
12 |
| - "- Regression Analysis with R: 25th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UMU1KRUpEOFRJQjFEOVVUVzFDMTRQMFZLRi4u)" |
| 55 | + "# Get today's date\n", |
| 56 | + "today = datetime.now()\n", |
| 57 | + "\n", |
| 58 | + "# Filter for rows that contain valid MS Form Signup links, Course Date information, and check if the 'End Date' is still valid\n", |
| 59 | + "filtered_courses_df = courses_df.dropna(subset=['Course Date', 'MS Form Signup'])\n", |
| 60 | + "filtered_courses_df = filtered_courses_df[filtered_courses_df['End Date'] > today]\n", |
| 61 | + "\n", |
| 62 | + "# Function to generate markdown text based on course details\n", |
| 63 | + "def generate_markdown(row):\n", |
| 64 | + " return f\"- {row['Course Name']}: {row['Course Date']} - [MS Form Signup]({row['MS Form Signup']})\"\n", |
| 65 | + "\n", |
| 66 | + "# Apply the function and create the markdown output\n", |
| 67 | + "markdown_output = filtered_courses_df.apply(generate_markdown, axis=1).tolist()\n", |
| 68 | + "\n", |
| 69 | + "# Join the markdown lines into a single block\n", |
| 70 | + "markdown_text = \"\\n\".join(markdown_output)\n", |
| 71 | + "\n", |
| 72 | + "# Display the markdown text in rendered form\n", |
| 73 | + "display(Markdown(markdown_text))" |
| 74 | + ] |
| 75 | + }, |
| 76 | + { |
| 77 | + "cell_type": "markdown", |
| 78 | + "id": "7101f2f7-2903-4cdc-b736-3f5000c467f7", |
| 79 | + "metadata": { |
| 80 | + "editable": true, |
| 81 | + "slideshow": { |
| 82 | + "slide_type": "" |
| 83 | + }, |
| 84 | + "tags": [] |
| 85 | + }, |
| 86 | + "source": [ |
| 87 | + "# Previous Workshops" |
| 88 | + ] |
| 89 | + }, |
| 90 | + { |
| 91 | + "cell_type": "code", |
| 92 | + "execution_count": 9, |
| 93 | + "id": "0a814add-f545-4663-8b06-39c40b636509", |
| 94 | + "metadata": { |
| 95 | + "editable": true, |
| 96 | + "slideshow": { |
| 97 | + "slide_type": "" |
| 98 | + }, |
| 99 | + "tags": [ |
| 100 | + "remove-input" |
| 101 | + ] |
| 102 | + }, |
| 103 | + "outputs": [ |
| 104 | + { |
| 105 | + "data": { |
| 106 | + "text/markdown": [ |
| 107 | + "<div align='center'>\n", |
| 108 | + "\n", |
| 109 | + "| Course Name | Course Info | Course Leader | Course Helpers | Course Developers |\n", |
| 110 | + "| --- | --- | --- | --- | --- |\n", |
| 111 | + "| Introduction to Python | 23rd/30th October 10am-1pm (online) | Tom Wilson | Liam Berrisford | Michael Saunby, Simon Kirby, Duncan McDougall, Eilis Hannon |\n", |
| 112 | + "\n", |
| 113 | + "</div>" |
| 114 | + ], |
| 115 | + "text/plain": [ |
| 116 | + "<IPython.core.display.Markdown object>" |
| 117 | + ] |
| 118 | + }, |
| 119 | + "metadata": {}, |
| 120 | + "output_type": "display_data" |
| 121 | + } |
| 122 | + ], |
| 123 | + "source": [ |
| 124 | + "import pandas as pd\n", |
| 125 | + "from IPython.display import display, HTML\n", |
| 126 | + "\n", |
| 127 | + "# Load the CSV file (adjust the file path as needed)\n", |
| 128 | + "file_path_previous = '../data/previous_workshops.csv'\n", |
| 129 | + "previous_courses_df = pd.read_csv(file_path_previous)\n", |
| 130 | + "\n", |
| 131 | + "# Strip any extra spaces in the column names\n", |
| 132 | + "previous_courses_df.columns = previous_courses_df.columns.str.strip()\n", |
| 133 | + "\n", |
| 134 | + "# Function to generate an HTML table row for each course\n", |
| 135 | + "def generate_html_row(row):\n", |
| 136 | + " return f\"<tr><td>{row['Course Name']}</td><td>{row['Course Info']}</td><td>{row['Course Leader']}</td><td>{row['Course Helpers']}</td><td>{row['Course Developers']}</td></tr>\"\n", |
| 137 | + "\n", |
| 138 | + "# Generate HTML table header\n", |
| 139 | + "html_table_header = \"\"\"\n", |
| 140 | + "<table style='width: 100%; text-align: center; border: 1px solid black; border-collapse: collapse;'>\n", |
| 141 | + "<tr>\n", |
| 142 | + "<th>Course Name</th>\n", |
| 143 | + "<th>Course Info</th>\n", |
| 144 | + "<th>Course Leader</th>\n", |
| 145 | + "<th>Course Helpers</th>\n", |
| 146 | + "<th>Course Developers</th>\n", |
| 147 | + "</tr>\n", |
| 148 | + "\"\"\"\n", |
| 149 | + "\n", |
| 150 | + "# Apply the function and create the HTML table rows\n", |
| 151 | + "table_rows = previous_courses_df.apply(generate_html_row, axis=1).tolist()\n", |
| 152 | + "\n", |
| 153 | + "# Join the table rows into a single block\n", |
| 154 | + "html_table = html_table_header + \"\\n\".join(table_rows) + \"</table>\"\n", |
| 155 | + "\n", |
| 156 | + "# Display the HTML table\n", |
| 157 | + "display(HTML(html_table))\n" |
13 | 158 | ]
|
14 | 159 | },
|
15 | 160 | {
|
16 | 161 | "cell_type": "code",
|
17 | 162 | "execution_count": null,
|
18 |
| - "id": "9f182a12-b6bf-4a95-b4c4-92c08951d8a1", |
19 |
| - "metadata": {}, |
| 163 | + "id": "2b3dc21f-a316-4357-8e4a-9c83c3703fd0", |
| 164 | + "metadata": { |
| 165 | + "editable": true, |
| 166 | + "slideshow": { |
| 167 | + "slide_type": "" |
| 168 | + }, |
| 169 | + "tags": [] |
| 170 | + }, |
20 | 171 | "outputs": [],
|
21 | 172 | "source": []
|
22 | 173 | }
|
|
0 commit comments