Web scraper which gathers school holiday data across a range of target years and states, and outputs it in a variety of useful csv formats.
Gathers data from a network of state by state websites like https://www.nswschoolholiday.com.au/ which track school holidays across australia.
Iteratively accesses & transforms tables across these sites for a specified range of years and pool of target states.
Does this through the main get_school_dates() function.
Clone the repo run the main function at the bottom of the Main.py script and customise the arguments as needed.
def get_school_dates(start_year,
end_year,
output_folder_target,
output_mode='startfinish',
targets=None,
show_qa_printouts=False,
drop_terms=True):The first year (inclusive) of the range of years you want data for.
The last year (inclusive) of the range of years you want data for.
The absolute path of the folder you want to save csv data outputs to.
Will output to the location of the Main.py file by default.
How you want to output the csv containing the data. See csv examples above.
Takes arguments:
- 'startfinish' - Dates represented by start and finish dates
- 'dayrows' - Each date and state combo between the start and finish represented in its own row
- 'binarydayrows' - Each date between the start and finish represented in its own row, with states as columns with either 1 or 0 representing if that date has a school holiday on that date.
Defaults to a list of all states, but can be set with any list of states like ['act','nsw','vic'].
False by default. If set to True will print useful information to the command line as the script runs.
True by default. If set to False rows representing the school terms won't be dropped from the output.
The final data output in format you specified in the output_mode argument.
Any state and year combinations that were not able to be scraped.
All rows that were removed throughing data cleaning. Should not contain any useful data, but worth checking.
File containing School holiday data for any States and Years which are not available via the web-scrape. This is used to fill out any missing information back to 2010.