Learning Python during COVID0-19

Python

Using simple examples of covid data manipulation and data representation for my independent study learning Python.

Xavier Prat-Resina https://pratresina.umn.edu (University of Minnesota Rochester)https://r.umn.edu
05-01-2020

Comparing current COVID pandemic with other causes of disease and death

Focusing on deaths and the same country

In order to get a better picture of the magnitude of the pandemics, counting number of deaths by covid instead of number of cases may better. It has been reported that many COVID cases go undetected either because they are asymptomatic or the country has no resources or strategy to diagnose them. While this is also true when applied to number of deaths, one can expect a higher number of tests on the individuals who pass away.

Also, different countries have different strategies or resources for testing for COVID so our comparison will only make sense if we compare within the same country.

Sources

Show code
import pandas as pd
import numpy as np
# pandas cheat sheet https://pandas.pydata.org/Pandas_Cheat_Sheet.pdf

flu = pd.read_csv("/Users/xavier/IndepStudy20/CodingSpring20_students/COVID19/flu_deaths_cdc.csv")
covid = pd.read_csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv")

states = covid['state'].unique()

How many people die on a regular basis? Using New York state as example.

In order to make sense of the current news it may be useful to first get a sense of how current deaths compare with previous, non-pandemic, years.

Show code
flu19ny = flu.loc[ (flu["season"] == "2018-19") & (flu['geoid'] == "State") & (flu["State"] == "New York")]
flu19ny = flu19ny.sort_values(by="MMWR Year/Week")
fluXweek = np.mean(flu19ny["Deaths from pneumonia and influenza"])
deatXweek = np.mean(flu19ny["All Deaths"])
print(fluXweek,deatXweek)
167.6 1988.2

On average, in New York state, every week {{fluXweek}} people die of flu/pneumonia out of a total average of {{deatXweek}} all deaths per week.

Show code
#flu19 = flu.loc[ (flu["season"] == "2018-19") & (flu['geoid'] == "State") ]

#flu19ny.plot.barh(x="MMWR Year/Week",y=["Deaths from pneumonia and influenza","All Deaths"],figsize=(15,15))
#flu19ny.plot.bar(x="MMWR Year/Week",y="All Deaths")

Citation

For attribution, please cite this work as

Prat-Resina (2020, May 1). Prat-Resina's blog: Learning Python during COVID0-19. Retrieved from https://xavierprat.github.io/Blog/posts/learning_python_during_covid/

BibTeX citation

@misc{prat-resina2020learning,
  author = {Prat-Resina, Xavier},
  title = {Prat-Resina's blog: Learning Python during COVID0-19},
  url = {https://xavierprat.github.io/Blog/posts/learning_python_during_covid/},
  year = {2020}
}