Skip to main content

packages used to throw around covid-19 data.

Project description

covid_19 Data Packages

An assortment of Data Scraping packages from publicly available git repos and website scrapings

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

This package is hosted on Pypi

python3 -m pip install covid-19-dryampy

Example Scripts

from covid_19.us_tests_cdc import us_tests_cdc

scraper = us_tests_cdc()
print(scraper.fetch())

or something a bit more complex;

from covid_19.csse_data import csse_retrieve
from covid_19.us_tests_cdc import us_tests_cdc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt


[data, dim_loc, dim_metric] = csse_retrieve().fetch()
test_dat = us_tests_cdc().fetch()

US_ids = dim_loc[dim_loc['Country/Region'] == 'US'].index.tolist()
US_data = data[data['loc_id'].isin(US_ids)]
US_case_data = US_data[US_data['metric_id'] == 0]
US_conf_cases = US_case_data[['counts', 'date']].groupby(['date']).agg(['sum'])
US_conf_cases.columns = ['total_counts']
US_conf_cases['daily_counts'] = np.gradient(US_conf_cases['total_counts'])

US_tests = test_dat[test_dat['status'] == 'complete']
US_tests['test_add'] = US_tests['cdc'] + US_tests['other']
US_tests = US_tests[['date', 'test_add']].groupby(['date']).agg(['sum'])
US_tests.columns = ['daily_counts']
US_tests['total_counts'] = US_tests['daily_counts'].cumsum()

final = US_conf_cases.join(US_tests, lsuffix='_cases', rsuffix='_tests')

ax = plt.gca()
plt.title('US tests and confirmed cases over time')

final2 = final.reset_index()
#final2.plot(kind='line',x='date',y='total_counts_tests', ax=ax, logy=True)
#final2.plot(kind='line',x='date',y='total_counts_cases', color='red', ax=ax, logy=True)
final2.plot(kind='line',x='date',y='total_counts_tests', color='blue', ax=ax)
final2.plot(kind='line',x='date',y='total_counts_cases', color='red', ax=ax)

plt.show()

Image description

Sources

US Test Data scraped from; https://www.cdc.gov/coronavirus/2019-ncov/cases-updates/testing-in-us.html World Confirmed/Recovered/Death data from https://github.com/CSSEGISandData/COVID-19

Authors

  • Steven Yampolsky

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE.md file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

covid-19-dryampy-0.3.9.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

covid_19_dryampy-0.3.9-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file covid-19-dryampy-0.3.9.tar.gz.

File metadata

  • Download URL: covid-19-dryampy-0.3.9.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.3

File hashes

Hashes for covid-19-dryampy-0.3.9.tar.gz
Algorithm Hash digest
SHA256 c9a5fd6fce891383ac8b22520f9fee88266982bdd843d1f165d862b8e49164bc
MD5 9fb4653163dbfcbd8992b167b7c14d51
BLAKE2b-256 e9e4f0cf8c1f85f5692a86a943b9d90ee1b89bbd7c2aab442950ed482b55d920

See more details on using hashes here.

File details

Details for the file covid_19_dryampy-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: covid_19_dryampy-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.3

File hashes

Hashes for covid_19_dryampy-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 81665e772a48015e572efe4426a0265764838dd13a134da98bbec29333dfbe34
MD5 322eb2c3a6ca1a92440ea190114df4a4
BLAKE2b-256 6cd9b19a730a8ce78f7203ae13d5f3e54b4cb63e94e6b7bf7360d021e8d348c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page