Epidemic Data for Novel Coronavirus COVID-19

Source Notebook

Estimated cases of novel coronavirus (COVID-19, formerly known as 2019-nCoV) infection by country or region (This data was imported and made computable on January 31, 2022)

Details

Estimated confirmed COVID-19 infection trend by country or region.
Data is based on WHO, U.S. CDC, ECDC, China CDC (CCDC), NHC and DXY.
Data for Hong Kong SAR, Macau SAR, and Taiwan is separate from data for China.
Note that the source dataset is compiled daily by Johns Hopkins CSSE and is known to sometimes disagree with numbers found in other sources. For details see: https://github.com/CSSEGISandData/COVID-19/issues

Examples

Basic Examples

Retrieve the default content:

In[1]:=
ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\)]
Out[1]=

Latest update date:

In[2]:=
ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\)][Max, #ConfirmedCases["LastDate"] &]
Out[2]=

Retrieve the data for five most affected countries:

In[3]:=
ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "WorldCountries"][
 TakeLargestBy[#ConfirmedCases["LastValue"] &, 5], {"Country", "ConfirmedCases", "RecoveredCases", "Deaths"}]
Out[3]=

Plot estimated confirmed cases by country over the past few months:

In[4]:=
DateListLogPlot[
 Callout[Tooltip[10^5 #2/#1["Population"], CommonName[#1]], #1] & @@@ Normal@ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "WorldCountries"][
     TakeLargestBy[#ConfirmedCases["LastValue"] &, 30]][
    All, {#Country, #ConfirmedCases} &], Sequence[
 PlotRange -> All, GridLines -> Automatic, AspectRatio -> 1.5, ImageSize -> 500, PlotLabel -> "estimated confirmed cases per 100K people (log scale)"]]
Out[4]=

Color countries by the latest confirmed cases:

In[5]:=
GeoHistogram[ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "WorldCountries"][
  All, #Country -> #ConfirmedCases[
     "LastValue"] &], "Country", Sequence[
 PlotLegends -> Automatic, PlotStyle -> {
Opacity[1], 
EdgeForm[{
Thickness[Tiny], 
GrayLevel[0.5]}]}]]
Out[5]=

Visualize the trend of new cases in twenty most affected countries:

In[6]:=
ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "WorldCountries"][
      TakeLargestBy[#ConfirmedCases["LastValue"] &, 20]][
     SortBy[FindPeaks[
          MovingAverage[Differences[#ConfirmedCases], Quantity[4, "Weeks"]], 10]["DatePath"][[1, 1]] &]][
    All, #Country -> Rescale[TimeSeries[
         MovingAverage[Differences[#ConfirmedCases], Quantity[1, "Weeks"]], MissingDataMethod -> Automatic][
        "Values"]] &] // Normal // Association // MatrixPlot[Values[#], FrameTicks -> {MapIndexed[{#2[[1]], #1} &, CommonName@Keys[#]], ReleaseHold[
Hold[
Part[
MapIndexed[{
Part[#2, 1], #}& , 
Map[Rotate[#, 90 Degree]& , 
Map[DateString[#, {"Month", "/", "Day"}]& , 
DateRange[
DateObject[{2020, 2, 1}], Today]]]], 
Span[1, All, 10]]]]}, ReleaseHold[
Hold[ColorFunction -> "Rainbow", Mesh -> {True, False}, AspectRatio -> 1/2, ImageSize -> 600, PlotLabel -> "top 20 counties with largest confirmed cases, sorted by date of first wave\n data updated on " <> DateString[
       Yesterday, "ISODate"]]]] &
Out[6]=

Estimated new cases and deaths (7 day average) in the US:

In[7]:=
DateListLogPlot[ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "WorldCountries"][
   SelectFirst[#Country == Entity["Country", "UnitedStates"] &], {"ConfirmedCases", "Deaths"}][All, MovingAverage[Differences[#], Quantity[1, "Weeks"]] &], Sequence[
 PlotRange -> {{{2020, 3, 1}, Automatic}, Automatic}, PlotLegends -> {"confirmed cases", "deaths"}, PlotLabel -> "estimated new cases in the US (log scale)", Filling -> {1 -> Bottom, 2 -> Bottom}, PlotMarkers -> Automatic, ImageSize -> 300, PlotRange -> Full]]
Out[7]=

Color US states by the latest confirmed cases:

In[8]:=
GeoRegionValuePlot[ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "USStates"][
  All, {#AdministrativeDivision, #ConfirmedCases["LastValue"]} &]]
Out[8]=

Explore the trend of new cases (7 day average) in each US state:

In[9]:=
ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "USStates"][All, DateListPlot[{#, MovingAverage[#, Quantity[1, "Weeks"]]} &@
      TimeSeriesWindow[Differences[#ConfirmedCases], ReleaseHold[
Hold[{
DateObject[{2020, 3, 1}, "Day", "Gregorian", -5.], Yesterday}]]], Epilog -> {Text[
        Style[#AdministrativeDivision[
          EntityProperty["AdministrativeDivision", "StateAbbreviation"]], Bold, 11], Scaled[{.96, .96}], {1, 1}], Text[Style[ToString@#ConfirmedCases["LastValue"], 11], Scaled[{.96, .96}], {1, 3}]}, Sequence[
     FrameTicks -> None, Filling -> {1 -> 0}, PlotStyle -> {
Directive[
RGBColor[1, 0, 0], 
Opacity[0.01]], 
Directive[
Thickness[0.01], 
RGBColor[1, 0, 0]]}, PlotRange -> {0, All}, FillingStyle -> Directive[
Thickness[0.015], 
Opacity[0.2]], Joined -> {False, True}, ImageSize -> Tiny]] &] // Normal // Multicolumn[#, 7] &
Out[9]=

Retrieve the data for five most affected US counties:

In[10]:=
ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "USCounties"][
 TakeLargestBy[#ConfirmedCases["LastValue"] &, 5], {"County", "ConfirmedCases", "Deaths"}]
Out[10]=

Color the counties of each state by the latest confirmed cases:

In[11]:=
Manipulate[
 GeoRegionValuePlot[
  Normal@data[Select[MatchQ[state, #State] &]][
    All, {#County, 10^5*#ConfirmedCases["LastValue"]/#County["Population"] /. Power["People", -1] -> IndependentUnit["per 100K people"]} &]], {state, states}, Initialization :> {data = ResourceData[\!\(\*
TagBox["\"\<Epidemic Data for Novel Coronavirus COVID-19\>\"",
#& ,
BoxID -> "ResourceTag-Epidemic Data for Novel Coronavirus COVID-19-Input",
AutoDelete->True]\), "USCounties"]; states = EntityList[
     EntityClass["AdministrativeDivision", "AllUSStatesPlusDC"]]}, Sequence[
 SynchronousUpdating -> False, SynchronousInitialization -> False]]
Out[11]=

Wolfram Research, "Epidemic Data for Novel Coronavirus COVID-19" from the Wolfram Data Repository (2022)   https://doi.org/10.24097/wolfram.04123.data

Data Resource History

Source Metadata

See Also

Data Downloads

Publisher Information