lisphilar / covid19-sir

CovsirPhy: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models.
https://lisphilar.github.io/covid19-sir/
Apache License 2.0
109 stars 44 forks source link

[Fix] JHUData.records(): complement is done after subsetting with start date #921

Closed lisphilar closed 3 years ago

lisphilar commented 3 years ago

Summary

Because complement is done after subsetting with start date, un-expected date is sometimes selected as the first date of JHUData.records(). The output of complement is dependent of the start date when subsetting.

For example, "01May2020" is expected as the first date with jhu_data.records(country="Japan", start_date="01May2020"), but "02May2020" is returned.

Codes and outputs

https://gist.github.com/lisphilar/fcecfa840a1f14acdb706508cddda6fa

Environment

lisphilar commented 3 years ago

With #922, "01May2020" will be the first date.

jhu_data.records(country="Japan", start_date="01May2020")[0].head(20)
  Date Confirmed Infected Fatal Recovered Susceptible
0 2020/5/1 1454 305 402 747 1.27E+08
1 2020/5/2 1481 259 426 796 1.27E+08
2 2020/5/3 1511 199 458 854 1.27E+08
3 2020/5/4 1533 171 475 887 1.27E+08
4 2020/5/5 1551 178 485 888 1.27E+08
5 2020/5/6 1564 170 505 889 1.27E+08
6 2020/5/7 1575 172 513 890 1.27E+08
7 2020/5/8 1583 173 518 892 1.27E+08
8 2020/5/9 1594 143 558 893 1.27E+08
9 2020/5/10 1604 141 570 893 1.27E+08
10 2020/5/11 1609 138 578 893 1.27E+08
11 2020/5/12 1616 124 598 894 1.27E+08
12 2020/5/13 1632 117 621 894 1.27E+08
13 2020/5/14 1637 104 639 894 1.27E+08
14 2020/5/15 1649 92 660 897 1.27E+08
15 2020/5/16 1653 81 674 898 1.27E+08
16 2020/5/17 1658 66 692 900 1.27E+08
17 2020/5/18 1660 61 697 902 1.27E+08
18 2020/5/19 1666 51 710 905 1.27E+08
19 2020/5/20 1668 45 717 906 1.27E+08