Using something like what is in the link, I want to find a function that inputs county and outputs total Covid-19 cases in that county and, as a separate function, one that outputs total Covid-19 deaths in that county. TIA!


  • $\begingroup$ Do you mean 'Country' or 'County'? For the US, county names are ambiguous, name of the state is needed to disambiguate. $\endgroup$ Jun 21, 2020 at 17:56

1 Answer 1


Make sure you got the latest, and not running on old cache:

ResourceUpdate[ResourceObject["Epidemic Data for Novel Coronavirus COVID-19"]]

and get the data:

data=ResourceData["Epidemic Data for Novel Coronavirus COVID-19","USCounties"];

I think something like this will do the job:

Select[MatchQ[Interpreter["USCounty"][c<>" county, "<>s],#County]&]][

Select[MatchQ[Interpreter["USCounty"][c<>" county, "<>s],#County]&]][

Note another way of writing this functions is for instance:

        MatchQ[Interpreter["USCounty"][c<>" county, "<>s],#County]&]][

Usage case:

In[]:= usaCountyCases["fl","pinellas"]
Out[]= 3438

In[]:= usaCountyDeaths["fl","pinellas"]
Out[]= 114

which at this moment gives the same as for instance Google:


enter image description here

  • 1
    $\begingroup$ It isn't working, although it looks perfect. Are any of those commands strictly version 12? I have version 11.1. Is that why these aren't running? $\endgroup$ Jun 22, 2020 at 2:07
  • 1
    $\begingroup$ My version is 12.1.1. and does work in that version :-) You can see if some commands are not available in your version by them being blue instead oof black. Also you can simply check if the functions are in your docs. Make sure you got all the data properly before running the functions. $\endgroup$ Jun 22, 2020 at 3:14
  • 1
    $\begingroup$ I tried it in a higher version and it works. What I ultimately want to do is find the correlation between county population density versus county covid-19 cases. I just set it up and am running trial code. In cases with a small number of counties, 5 counties take 20 seconds to get the correlation, so just imagine 3109 counties. I hope it will be done in 3-4 hours. Is this long crunch time to be expected? $\endgroup$ Jun 22, 2020 at 17:14
  • $\begingroup$ @VeritasLux this is a different question, you might want to ask it as a separate question. The way data accessed, and hence speeds, in these 2 cases might be different. $\endgroup$ Jun 22, 2020 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.