Wolfram Research

Epidemic Data for Novel Coronavirus COVID-19

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 July 1, 2020.)

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 resource:

In[1]:=
ResourceObject["Epidemic Data for Novel Coronavirus COVID-19"]
Out[1]=

Retrieve the default content:

In[2]:=
ResourceData["Epidemic Data for Novel Coronavirus COVID-19"]
Out[2]=

Latest update date:

In[3]:=
ResourceData[
  "Epidemic Data for Novel Coronavirus COVID-19"][Max, \
#ConfirmedCases["LastDate"] &]
Out[3]=

Retrieve the data for five most affected countries:

In[4]:=
ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "WorldCountries"][
 TakeLargestBy[#ConfirmedCases["LastValue"] &, 5], {"Country", "ConfirmedCases", "RecoveredCases", "Deaths"}]
Out[5]=

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

In[6]:=
DateListLogPlot[
 Callout[Tooltip[10^5 #2/#1["Population"], CommonName[#1]], #1] & @@@ Normal@ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "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[7]=

Color countries by the latest confirmed cases:

In[8]:=
GeoHistogram[
 ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "WorldCountries"][
  All, #Country -> #ConfirmedCases[
     "LastValue"] &], "Country", Sequence[
 PlotLegends -> Automatic, PlotStyle -> {
Opacity[1], 
EdgeForm[{
Thickness[Tiny], 
GrayLevel[0.5]}]}]]
Out[9]=

Visualize the trend of new cases in twenty most affected countries

In[10]:=
ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "WorldCountries"][
      TakeLargestBy[#ConfirmedCases["LastValue"] &, 20]][
     SortBy[MaximalBy[
         MovingAverage[Differences[#ConfirmedCases], Quantity[1, "Weeks"]]["DatePath"], Last][[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[#]], {{
      1, 
Rotate["02/01", 90 Degree]}, {11, 
Rotate["02/11", 90 Degree]}, {21, 
Rotate["02/21", 90 Degree]}, {31, 
Rotate["03/02", 90 Degree]}, {41, 
Rotate["03/12", 90 Degree]}, {51, 
Rotate["03/22", 90 Degree]}, {61, 
Rotate["04/01", 90 Degree]}, {71, 
Rotate["04/11", 90 Degree]}, {81, 
Rotate["04/21", 90 Degree]}, {91, 
Rotate["05/01", 90 Degree]}, {101, 
Rotate["05/11", 90 Degree]}, {111, 
Rotate["05/21", 90 Degree]}, {121, 
Rotate["05/31", 90 Degree]}}}, Sequence[
   ColorFunction -> "Rainbow", Mesh -> {True, False}, AspectRatio -> Rational[1, 2], ImageSize -> 600, PlotLabel -> "top 20 counties with largest confirmed cases, \
sorted by date of first wave"]] &
Out[11]=

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

In[12]:=
DateListLogPlot[
 ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "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[13]=

Color US states by the latest confirmed cases:

In[14]:=
Show[GeoRegionValuePlot[
  ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "USStates"][
   All, {#AdministrativeDivision, #ConfirmedCases["LastValue"]} &]], GeoBubbleChart[
  ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "USStates"][All, {#GeoPosition, #ConfirmedCases["LastValue"]} &], ChartStyle -> RGBColor[
   0.8588235294117647, 0.5607843137254902, 0.4588235294117647]]]
Out[15]=

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

In[16]:=
ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "USStates"][All,
   DateListPlot[{#, MovingAverage[#, Quantity[1, "Weeks"]]} &@
      TimeSeriesWindow[Differences[#ConfirmedCases], {
DateObject[{2020, 3, 1}, "Day", "Gregorian", -5.], 
DateObject[{2020, 6, 8}, "Day", "Gregorian", -5.]}], 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[17]=

Retrieve the data for five most affected US counties:

In[18]:=
ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "USCounties"][
 TakeLargestBy[#ConfirmedCases["LastValue"] &, 5], {"County", "ConfirmedCases", "Deaths"}]
Out[19]=

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

In[20]:=
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["Epidemic Data for Novel Coronavirus COVID-19", "USCounties"]; states = EntityList[
     EntityClass["AdministrativeDivision", "AllUSStatesPlusDC"]]}, SynchronousUpdating -> False]
Out[21]=

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

Data Resource History

Source Metadata

See Also

Data Downloads

Publisher Information