Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

not exported

DayDate
105/6/2023
206/6/2023
307/6/2023
409/6/2023
SlotTimings
110:00–11:15
211:30–13:00
314:00–15:15
415:30–17:00
DaySlotRowTitle
111Introduction to the course
122Intro to RL
133OpenAI Gym, Gymnasium
144Lab: Frozen-Lake play
215MDPs
226Dynamic Programming
237Lab: Solving Frozen-Lake
248Monte Carlo Methods
319Lab: Blackjack with MC
3210Function Approximation
3311DQN, SAC, PPO
3412Lab: Breakout
4113Lab: Demo day
4214Demos and wrap up
# ensure you set pyvenv-workon to ical first
import pandas as pd
from icalendar import Calendar, Event
import datetime
import re
mre = re.compile(r"([0-9]*:[0-9]*)--([0-9]*:[0-9]*)")
timeformat = "%H:%M"

def convert_time_range(s):
    m = mre.match(s)
    assert m
    return (datetime.datetime.strptime(m[1], timeformat).time(),
            datetime.datetime.strptime(m[2], timeformat).time())

slots = (pd.DataFrame(timetable, columns=["day", "slot", "row", "title"])
         .assign(day=lambda x: x.day.astype(int))
         )

times = (pd.DataFrame(times, columns=["slot", "times"])
         .assign(slot=lambda x: x.slot.astype(int))
         .assign(time_range=lambda x: x.times.apply(convert_time_range))
         .drop(['times'], axis=1)
         .set_index("slot")
         )

daydate = (pd.DataFrame(daydate, columns=["day", "date"])
           .assign(day=lambda x: x.day.astype(int),
                   date=lambda x: x.date.apply(lambda y: datetime.datetime.strptime(y, "%d/%m/%Y")))
           .set_index("day")
           )



slots = (slots.join(times, on='slot')
 .join(daydate, on="day")
)

cal = Calendar()
cal.add('prodid', '-//My calendar product//mxm.dk//')
cal.add('version', '2.0')

for ix, row in slots.iterrows():

    tz = datetime.timezone(datetime.timedelta(hours=5))
    dstart = datetime.datetime.combine(row.date, row.time_range[0], tzinfo=tz)
    dend = datetime.datetime.combine(row.date, row.time_range[1], tzinfo=tz)

    event = Event()
    event.add('summary', row.title)
    event.add('location', "")
    event.add('dtstart', dstart)
    event.add('dtend', dend)
    event.add('dtstamp', datetime.datetime.now())
    cal.add_component(event)


with open("rl-course.ics", "wb") as f:
    f.write(cal.to_ical())

from os import system    
    
system("rsync rl-course.ics cogentee:public_html/rl-course.ics")