2
$\begingroup$

I have the following code for retrieving world-wide COVID-19 data.

data = Import["https://www.worldometers.info/coronavirus", "Data"];
TableForm[data[[2, 2, 2, 1, 2]], TableHeadings -> {None, data[[2, 2, 2, 1, 1]]}];
TableForm[Drop[\!\(\*
   TagBox[
   RowBox[{"data", "[[", 
   RowBox[{"2", ",", "2", ",", "2", ",", "1", ",", "2"}], "]]"}],
   Function[BoxForm`e$, 
   TableForm[BoxForm`e$, TableHeadings -> {None, 
   Part[$CellContext`tt, 2, 2, 2, 1, 1]}]]]\), {1, 8}], 
   TableHeadings -> {None, data[[2, 2, 2, 1, 1]]}];

dataTable = 
Cases[data, {{"#", "Country, Other", "Total Cases", "New Cases", 
 "Total Deaths", ___}, ___}, \[Infinity]];
Length[dataTable]

index = 1;
ResourceFunction["GridTableForm"][dataTable[[index, 1]]]
ResourceFunction["GridTableForm"][dataTable[[index, 3]]]
ResourceFunction["GridTableForm"][dataTable[[index, 2]]]

I have MMA version 11.3 and tried many different ways of importing time-series of COVID-19 data across countries, but I failed badly. The above code however works with some caveats.

  1. not available or 0 data cells are shifted as if there is data in the cells concerned. When you run:

     ResourceFunction["GridTableForm"][dataTable[[index, 2]]]
    

you will see what I mean by shifting data cells. See, for example, data for Brazil today. Today's data has not been reported and hence needs to be zero, but the data cell from the adjacent column is shifted to the previous column.

  1. Is there any way to import time series data sets in the indicated data link? I do not know how to search for time series data?

  2. Is there any bug or problems with MMA 11.3 that prevents the currently available MMA commands to work? I have tried many different commands (which work in MMA version 12) that do not work with MMA 11.3.

I have been trying to get the COVID-19 data for about 2 months but nothing is working except the above (that lacks time-series data and data cell shift problem).

EDIT 1

I also managed to get the table from ECDC covid database and format the data in TableForm.

data = Import[
"https://www.ecdc.europa.eu/en/geographical-distribution-2019-ncov-\
 cases", "Data"];

data[[1, 3, 2, 2, 1, 2]]=Delete[data[[1, 3, 2, 2, 1, 2]], {1, 1}];
data[[1, 3, 2, 2, 1, 2]]=Delete[data[[1, 3, 2, 2, 1, 2]], {56,1}];
data[[1, 3, 2, 2, 1, 2]]=Delete[data[[1, 3, 2, 2, 1, 2]], {105,1}];
data[[1, 3, 2, 2, 1, 2]]=Delete[data[[1, 3, 2, 2, 1, 2]], 147];
data[[1, 3, 2, 2, 1, 2]]=Delete[data[[1, 3, 2, 2, 1, 2]], {202, 1}];
data[[1, 3, 2, 2, 1, 2]] = Delete[data[[1, 3, 2, 2, 1, 2]], 215];
data[[1, 3, 2, 2, 1, 1]] = Delete[data[[1, 3, 2, 2, 1, 1]], 1];

TableForm[\!\(\*
TagBox[
RowBox[{"data", "[[", 
RowBox[{"1", ",", "3", ",", "2", ",", "2", ",", "1", ",", "2"}], 
 "]]"}],
Function[BoxForm`e$, 
TableForm[BoxForm`e$, TableHeadings -> {None, 
Part[$CellContext`tt, 2, 2, 2, 1, 1]}]]]\), 
TableHeadings -> {None, data[[1, 3, 2, 2, 1, 1]]}]

This ECDC database is not covering some of the variables I am interested in such as new daily cases or a time-series of the new daily cases. I would appreciate it if someone gives me possible url links to have access to the Covid-19 data concerned.

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.