yiluheihei / nCoV-2019-Data

covid 2019 data
MIT License
1 stars 1 forks source link

some old data are missing continentname field value #1

Open l1t1 opened 4 years ago

l1t1 commented 4 years ago

I load the data into sqlite database with following command

.mode csv
.import  ../ncov.csv ncov
.header on
select * from ncov where  continentname='NA';

NA,NA,"俄罗斯",Russia,"俄罗斯",Russia,964006,2,0,0,0,2020-01-31T21:09:48Z,NA,NA,NA,NA,NA,NA,NA NA,NA,"泰国",Thailand,"泰国",Thailand,952010,19,0,5,0,2020-01-31T18:27:47Z,NA,NA,NA,NA,NA,NA,NA ...

l1t1 commented 4 years ago

you can update these value with following command , and save the data to a new csv file

update ncov as a set continentname=
(select distinct b.continentname  from ncov as b where  continentname<>'NA' and b.provincename=a.provincename)
where continentname='NA';
.once newcov.csv
select * from ncov;
l1t1 commented 4 years ago

and use this command to get a dataset of last record of everyday data

.once dailyncov.csv

with t as(select substr(updateTime,1,10)dt,province_confirmedCount,province_suspectedCount,province_curedCount,province_deadCount ,continentName,provinceName
from ncov where (updateTime,continentName,provinceName,substr(updateTime,1,10)) in 
  (select max(updateTime)tm,continentName,provinceName,substr(updateTime,1,10) from ncov group by continentName,provinceName,substr(updateTime,1,10)))
select * from t;
yiluheihei commented 4 years ago

Thanks. The origin data is from here. I am not familar with sqlite, and if necessary the missing continentname field value can be fixed by comparing the continentname field in the newer data.