Retrieve the dates of restructions imposed on countries around the world during the covid pandemic. Helpful for maching learning projects with a time element during the feature engineering phase.

class LockdownDates[source]

LockdownDates(country:Union[typing.List[str], str], start_date:str, end_date:str, restrictions:Union[typing.List, typing.Tuple])

Retrieve the dates of the restrictions in countries imposed by governments around the world during the covid-19 pandemic.

country: Country from table of countries in README.md
start_date: Date you wish to collect dates from in "YYYY-MM-DD" format
end_date: Date you wish to collect dates from in "YYYY-MM-DD" format restrictions: List of restrictions to be returned listed in README.md

ld = LockdownDates("Aruba", "2022-01-01", "2022-01-30", ("stay_at_home", "masks"))
x = ld.dates()
x
Fetching lockdown dates...
Fetched lockdown dates for: Aruba
aruba_country_code aruba_masks aruba_stay_at_home
timestamp
2022-01-01 ABW 2.0 2.0
2022-01-02 ABW 2.0 2.0
2022-01-03 ABW 2.0 2.0
2022-01-04 ABW 2.0 2.0
2022-01-05 ABW 2.0 2.0
2022-01-06 ABW 2.0 2.0
2022-01-07 ABW 2.0 2.0
2022-01-08 ABW 2.0 2.0
2022-01-09 ABW 2.0 2.0
2022-01-10 ABW 2.0 2.0
2022-01-11 ABW 2.0 2.0
2022-01-12 ABW 2.0 2.0
2022-01-13 ABW 2.0 2.0
2022-01-14 ABW 2.0 2.0
2022-01-15 ABW 2.0 2.0
2022-01-16 ABW 2.0 2.0
2022-01-17 ABW 2.0 2.0
2022-01-18 ABW 2.0 2.0
2022-01-19 ABW 2.0 2.0
2022-01-20 ABW 2.0 2.0
2022-01-21 ABW 2.0 2.0
2022-01-22 ABW 2.0 2.0
2022-01-23 ABW 2.0 2.0
2022-01-24 ABW 2.0 2.0
2022-01-25 ABW 2.0 2.0
2022-01-26 ABW 2.0 2.0
2022-01-27 ABW 2.0 2.0
2022-01-28 ABW 2.0 2.0
2022-01-29 ABW 2.0 2.0
2022-01-30 ABW 2.0 2.0

LockdownDates.dates[source]

LockdownDates.dates(save:bool=False)

Returns the restriction lockdown dates for a specific set of countries.

Parameters
     save : bool, optional
         saves restrictions to a csv file for caching (default is False)

Returns:
     DataFrame containing the dates a country was subject to certain restrictions during the pandemic.

Raises:
     Exception: failed to collect data.

ld = LockdownDates("Aruba", "2022-01-01", "2022-01-30", ["stay_at_home", "masks"])
assert ld.country==["Aruba"]
assert type(ld.country)==list
assert ld.start_date==dt(2022, 1, 1, 0, 0)
assert type(ld.start_date)==dt
assert ld.end_date==dt(2022, 1, 30, 0, 0)
assert type(ld.end_date)==dt
assert ld.restrictions==["stay_at_home", "masks"]
assert type(ld.restrictions)==list