コード例 #1
0
# run
formatter = Formatter(args)

## First, we load the data and identify some counties we're interested in
## Let's go with King County, WA (where the first US case was identified), and WESTCHESTER
infections = pd.read_csv(
    join(formatter.raw_data_dir,
         'national/USAfacts_infections/covid_confirmed_usafacts_aligned.csv'))
deaths = pd.read_csv(
    join(formatter.raw_data_dir,
         'national/USAfacts_infections/covid_deaths_usafacts_aligned.csv'))
fips = [53033, 36119]

## Extract the features from those counties
national_data = formatter.parse_national_data()
king_data = national_data[str(fips[0])]
westchester_data = national_data[str(fips[1])]

king_population = int(king_data['population'][6]) * susceptible_factor
westchester_population = int(
    westchester_data['population'][6]) * susceptible_factor

## To get a general overview of the data, we can first plot them
#timeseries.plot_timeseries(infections, fips=fips, label='Infections')
#timeseries.plot_timeseries(deaths, fips=fips, label='Deaths')

## Let's take a deeper look at the data and see how the growth in these two counties compare
## Read out the timeseries in each county and we can calculate the growth rate
king_time, king_infections, king_deaths = utils.get_timeseries(
    infections, deaths, fips[0])