ubiq-x / localedb-py

Python bindings for LocaleDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

localedb-py

Python bindings for LocaleDB.

Dependencies

Setup

pip install git+https://github.com/momacs/localedb-py.git

Remember to activate your venv of choice unless you want to go system-level.

Usage

from localedb import LocaleDB
db = LocaleDB()

print(db.get_rand_us_state_fips(3))   # select three random U.S. state  FIPS codes
print(db.get_rand_us_county_fips(3))  # select three random U.S. county FIPS codes

db.set_disease('COVID-19')      # set COVID-19 as the current disease
db.set_locale_by_name('Italy')  # set Italy as the current locale

db.set_locale_by_name('US', 'Alaska')  # set the state of Alaska as the current locale
db.set_locale_by_us_fips('02')         # same

db.set_locale_by_name('US', 'Alaska', 'Anchorage')  # set the county of Anchorage, Alaska as the current locale
db.set_locale_by_us_fips('02020')                   # same

conf = db.get_dis_dyn_by_day_conf(20,77)  # get the time series of confirmed cases from day 20 to day 77
print(conf.flatten().tolist())            # print that time series

The last instruction should result in the following being printed:

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 3, 5, 5, 5, 7, 16, 17, 21, 30, 35, 45, 59, 61, 63, 66, 68, 75, 82, 86, 89, 99, 105]

Usage Examples

The following computational notebooks (located in a separate repository) demonstrate the usage and capabilities of the package:

License

This project is licensed under the BSD License.

About

Python bindings for LocaleDB

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%