This is a highly edited take on @kevin's estimated R

This is me working through toy examples, please don't ready anything into this.

In [5]:
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import dates as mdates
import sys, pathlib
sys.path.append(str(pathlib.Path(".")))
# Kevin did a lot of great work, but I want to iterate without the repetition of it all - 
# I moved all the functions to an external file, because I wanted to see if I could import that in a cloud notebook service.
from helper_functions import get_county_stats, plot_rt
%matplotlib inline

Settings here

In [2]:
county_name = 'Morris'
state_name = 'New Jersey'
stat_column = 'cases'
In [3]:
original_stats, smoothed_data, likely_range = get_county_stats(county_name, state_name, stat_column)
fig, ax = plt.subplots(figsize=(600/72,400/72))
plot_rt(likely_range, ax, county_name)
fig.set_facecolor('w')
ax.set_title(f'Real-time $R_t$ for {county_name} county, {state_name}')
ax.set_ylim(.5,3.5)
ax.xaxis.set_major_locator(mdates.WeekdayLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%b %d'))
In [7]:
# Raw cases, not nicely plotted
original_stats.plot()
Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f54891ff630>
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: