Created
January 12, 2023 21:47
-
-
Save joejag/a918353618a6d60d36427b3d726f128b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as DT | |
from itertools import cycle | |
import csv | |
rota = cycle( | |
[ | |
"Brown", | |
"Blue", | |
"Green + Brown", | |
"Blue", | |
"Brown", | |
"Green + Blue", | |
] | |
) | |
with open("bins.csv", "w") as file: | |
fieldnames = ["Subject", "Start date"] | |
writer = csv.DictWriter(file, fieldnames=fieldnames) | |
writer.writeheader() | |
for week in range(0, 52): | |
pickup_day = DT.date(2023, 1, 6) + DT.timedelta(days=7 * week) | |
bin = next(rota) | |
writer.writerow({"Subject": f"{bin} bin day", "Start date": pickup_day}) | |
for pickup_number in range(0, 6): | |
pickup_day = DT.date(2023, 2, 22) + DT.timedelta(days=7 * pickup_number * 8) | |
writer.writerow({"Subject": "Purple bin day", "Start date": pickup_day}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment