Unverified Commit 5ceae43e authored by Simon Bowly's avatar Simon Bowly
Browse files

Cleanup.

parent c40ff7cb
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"""
Might be a useful script for some groups to adapt, since most datasets are split
across many different files.
"""
from pathlib import Path
from urllib.request import urlretrieve
import pandas as pd
data_url = "https://compedv2api.herokuapp.com/api/bydatecsv/"
download_dir = Path(__file__).parent.joinpath("data")
download_dates = pd.date_range(start="2020-03-01", end="2020-03-08", freq="D")
download_dir.mkdir(exist_ok=True)
for date in download_dates:
downloaded_file_path = download_dir.joinpath(date.strftime("%Y-%m-%d") + ".csv")
if downloaded_file_path.exists():
print("Already loaded: ", date)
else:
urlretrieve(data_url + date.strftime("%d-%m-%Y"), downloaded_file_path)
print("Download complete: ", date)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment