Access to external data, constants, and important dates.

Sources

nofilt[source]

nofilt(x)

class API[source]

API(settings, date_ff=nofilt, custom_getter=None)

API.get_all_data_statewide[source]

API.get_all_data_statewide(min_date='2020-03-15')

Gets statewide aggregated data.

ny = API(api_settings['NYS'][:2])
df = ny.get_all_data_statewide()
df.head()
Tests Positives Date Odds
date
2020-03-15 1936 294 2020-03-15 0.179050
2020-03-16 2907 432 2020-03-16 0.174545
2020-03-17 4553 1009 2020-03-17 0.284707
2020-03-18 7698 1769 2020-03-18 0.298364
2020-03-19 10124 2950 2020-03-19 0.411207
ct = API(api_settings['Connecticut'][:2])
df = ct.get_all_data_statewide()
df.head()
Tests Positives Date Odds
date
2020-03-15 137 27 2020-03-15 0.245455
2020-03-16 572 134 2020-03-16 0.305936
2020-03-17 1052 160 2020-03-17 0.179372
2020-03-18 1397 251 2020-03-18 0.219023
2020-03-19 1526 300 2020-03-19 0.244698
vi = API(api_settings['Virginia'][:2], **api_settings['Virginia'][2])
df = vi.get_all_data_statewide()
df.head()
Tests Positives Date Odds
date
2020-03-15 88 7 2020-03-15 0.086420
2020-03-16 325 12 2020-03-16 0.038339
2020-03-17 224 23 2020-03-17 0.114428
2020-03-18 424 19 2020-03-18 0.046914
2020-03-19 593 92 2020-03-19 0.183633

massachusetts_getter[source]

massachusetts_getter(url_base, usecols)

ma = API(api_settings['Massachusetts'][:2], **api_settings['Massachusetts'][2])
df = ma.get_all_data_statewide()
df.head()
Tests Positives Date Odds
date
2020-03-15 1017 68 2020-03-15 0.071654
2020-03-16 2121 150 2020-03-16 0.076104
2020-03-17 2656 249 2020-03-17 0.103448
2020-03-18 2949 259 2020-03-18 0.096283
2020-03-19 2871 278 2020-03-19 0.107212

michigan_getter[source]

michigan_getter(base_url, usecols)

mi = API(api_settings['Michigan'][:2], **api_settings['Michigan'][2])
df = mi.get_all_data_statewide()
df.head()
Tests Positives Date Odds
date
2020-03-15 33 21 2020-03-15 1.750000
2020-03-16 156 16 2020-03-16 0.114286
2020-03-17 837 150 2020-03-17 0.218341
2020-03-18 754 154 2020-03-18 0.256667
2020-03-19 741 166 2020-03-19 0.288696

rhode_island_getter[source]

rhode_island_getter(base_url, usecols)

ri = API(api_settings['Rhode Island'][:2], **api_settings['Rhode Island'][2])
df = ri.get_all_data_statewide()
df.head()
Tests Positives Date Odds
date
2020-03-15 55 1 2020-03-15 0.018519
2020-03-16 97 2 2020-03-16 0.021053
2020-03-17 174 12 2020-03-17 0.074074
2020-03-18 125 9 2020-03-18 0.077586
2020-03-19 277 15 2020-03-19 0.057252

NYS Important Dates

Plot

plot_data_and_fit[source]

plot_data_and_fit(df, x, y, y_hat, yl, yu, logy=True, palette=None, ax=None, scalex=True, scaley=True, data=None)

from nbdev.export import notebook2script; notebook2script()
Converted 00_core.ipynb.
Converted 01_lasso.ipynb.
Converted 02_counterfactual.ipynb.
Converted index.ipynb.