diff --git a/README.md b/README.md index 9ab2955..26e46fc 100644 --- a/README.md +++ b/README.md @@ -3367,7 +3367,7 @@ continents = pd.read_csv('https://datahub.io/JohnSnowLabs/country-and-continent- df = pd.merge(covid, continents, left_on='iso_code', right_on='Three_Letter_Country_Code') df = df.groupby(['Continent_Name', 'date']).sum().reset_index() df['Total Deaths per Million'] = df.total_deaths * 1e6 / df.population -df = df[('2020-03-14' < df.date) & (df.date < '2020-10-23')] +df = df[('2020-03-14' < df.date) & (df.date < '2020-10-26')] df = df.rename({'date': 'Date', 'Continent_Name': 'Continent'}, axis='columns') line(df, x='Date', y='Total Deaths per Million', color='Continent').show() ``` @@ -3392,8 +3392,8 @@ def scrape_data(): url = f'{BASE_URL}{id_}?period1=1579651200&period2={now}&interval=1d&events=history' return pd.read_csv(url, usecols=['Date', 'Close']).set_index('Date').Close covid = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv', - usecols=['date', 'total_cases']) - covid = covid.groupby('date').sum() + usecols=['location', 'date', 'total_cases']) + covid = covid[covid.location == 'World'].set_index('date').total_cases dow, gold, bitcoin = [scrape_yahoo(id_) for id_ in ('^DJI', 'GC=F', 'BTC-USD')] dow.name, gold.name, bitcoin.name = 'Dow Jones', 'Gold', 'Bitcoin' return covid, dow, gold, bitcoin diff --git a/index.html b/index.html index 41ac3de..fe355f0 100644 --- a/index.html +++ b/index.html @@ -2858,7 +2858,7 @@ continents = pd.read_csv('https://datahub.io/JohnSnowL df = pd.merge(covid, continents, left_on='iso_code', right_on='Three_Letter_Country_Code') df = df.groupby(['Continent_Name', 'date']).sum().reset_index() df['Total Deaths per Million'] = df.total_deaths * 1e6 / df.population -df = df[('2020-03-14' < df.date) & (df.date < '2020-10-23')] +df = df[('2020-03-14' < df.date) & (df.date < '2020-10-26')] df = df.rename({'date': 'Date', 'Continent_Name': 'Continent'}, axis='columns') line(df, x='Date', y='Total Deaths per Million', color='Continent').show() @@ -2879,8 +2879,8 @@ line(df, x='Date', y= url = f'{BASE_URL}{id_}?period1=1579651200&period2={now}&interval=1d&events=history' return pd.read_csv(url, usecols=['Date', 'Close']).set_index('Date').Close covid = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv', - usecols=['date', 'total_cases']) - covid = covid.groupby('date').sum() + usecols=['location', 'date', 'total_cases']) + covid = covid[covid.location == 'World'].set_index('date').total_cases dow, gold, bitcoin = [scrape_yahoo(id_) for id_ in ('^DJI', 'GC=F', 'BTC-USD')] dow.name, gold.name, bitcoin.name = 'Dow Jones', 'Gold', 'Bitcoin' return covid, dow, gold, bitcoin diff --git a/web/covid_cases.js b/web/covid_cases.js index 8a867eb..6d74a14 100644 --- a/web/covid_cases.js +++ b/web/covid_cases.js @@ -253,7 +253,10 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { "2020-10-20", "2020-10-21", "2020-10-22", - "2020-10-23" + "2020-10-23", + "2020-10-24", + "2020-10-25", + "2020-10-26" ], "y": [ 100.0, @@ -496,10 +499,13 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { 101.11412171555918, 100.94579531386498, 100.82351279089583, - 100.76013021633324, - 100.70378136188316, - 100.60235832660891, - 100.53639551861964 + 100.68314250156283, + 100.47281821757198, + 100.14568154206695, + 99.78826985147477, + 99.47951094976546, + 99.40423383164321, + 99.25979808076009 ], "yaxis": "y2" }, @@ -750,7 +756,10 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { "2020-10-20", "2020-10-21", "2020-10-22", - "2020-10-23" + "2020-10-23", + "2020-10-24", + "2020-10-25", + "2020-10-26" ], "y": [ 100.0, @@ -993,10 +1002,13 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { 116.31357671050499, 116.18301671207496, 116.2653792355378, - 116.26964958595707, - 116.26232877170584, - 116.29520574354568, - 116.32206652401433 + 116.27107303609682, + 116.26659912212511, + 116.27819028679562, + 116.31560936064204, + 116.34164008702355, + 116.34536826901567, + 116.31952385818623 ], "yaxis": "y2" }, @@ -1247,7 +1259,10 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { "2020-10-20", "2020-10-21", "2020-10-22", - "2020-10-23" + "2020-10-23", + "2020-10-24", + "2020-10-25", + "2020-10-26" ], "y": [ 100.0, @@ -1491,9 +1506,12 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { 123.83856468187685, 125.41920751584826, 127.18138014691964, - 128.81272370627855, - 129.91843445644795, - 131.25335941953276 + 128.79371119015062, + 130.63416781610792, + 133.04466569320664, + 135.4426980448538, + 136.79525926584338, + 138.25723520448423 ], "yaxis": "y2" }, @@ -1744,253 +1762,259 @@ if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { "2020-10-20", "2020-10-21", "2020-10-22", - "2020-10-23" + "2020-10-23", + "2020-10-24", + "2020-10-25", + "2020-10-26" ], "y": [ - 157636.0, - 158682.0, - 160272.0, - 162006.0, - 164234.0, - 166776.0, - 170496.0, - 174146.0, - 178318.0, - 181806.0, - 186473.0, - 191200.0, - 197390.0, - 205522.0, - 213462.0, - 221802.0, - 231365.0, - 241807.0, - 257589.0, - 276218.0, - 297395.0, - 321919.0, - 346948.0, - 375446.0, - 409642.0, - 450230.0, - 512626.0, - 576597.0, - 645049.0, - 713589.0, - 802736.0, - 887803.0, - 995480.0, - 1117698.0, - 1248068.0, - 1373776.0, - 1488504.0, - 1617838.0, - 1767603.0, - 1922902.0, - 2078194.0, - 2242192.0, - 2412577.0, - 2545252.0, - 2691782.0, - 2846570.0, - 3016686.0, - 3191552.0, - 3370798.0, - 3521528.0, - 3658574.0, - 3789084.0, - 3943038.0, - 4100662.0, - 4269522.0, - 4434076.0, - 4593468.0, - 4734474.0, - 4883786.0, - 5058428.0, - 5191636.0, - 5349210.0, - 5495510.0, - 5695204.0, - 5858872.0, - 5992418.0, - 6138074.0, - 6297094.0, - 6468440.0, - 6645502.0, - 6806764.0, - 6960810.0, - 7116028.0, - 7275318.0, - 7451744.0, - 7637376.0, - 7816772.0, - 7993608.0, - 8142676.0, - 8285418.0, - 8459656.0, - 8634636.0, - 8829004.0, - 9025466.0, - 9211414.0, - 9369516.0, - 9545418.0, - 9738174.0, - 9948120.0, - 10165690.0, - 10379296.0, - 10577204.0, - 10761708.0, - 10943610.0, - 11132890.0, - 11340516.0, - 11579180.0, - 11825552.0, - 12081084.0, - 12292334.0, - 12497878.0, - 12724302.0, - 12977334.0, - 13232038.0, - 13499752.0, - 13750526.0, - 13977862.0, - 14195362.0, - 14448904.0, - 14720226.0, - 14993682.0, - 15283662.0, - 15549600.0, - 15788832.0, - 16032016.0, - 16318518.0, - 16671424.0, - 16952194.0, - 17314902.0, - 17633174.0, - 17885746.0, - 18158734.0, - 18487088.0, - 18838730.0, - 19196466.0, - 19575866.0, - 19938360.0, - 20256500.0, - 20580130.0, - 20967722.0, - 21372198.0, - 21789966.0, - 22201566.0, - 22577112.0, - 22930210.0, - 23284534.0, - 23701556.0, - 24133380.0, - 24583302.0, - 25046742.0, - 25478180.0, - 25866566.0, - 26251672.0, - 26701780.0, - 27170356.0, - 27682658.0, - 28180312.0, - 28634352.0, - 29061608.0, - 29470880.0, - 29953952.0, - 30521732.0, - 31073414.0, - 31641988.0, - 32155968.0, - 32614654.0, - 33045348.0, - 33534756.0, - 34134708.0, - 34715158.0, - 35269686.0, - 35793730.0, - 36235556.0, - 36650196.0, - 37163816.0, - 37720888.0, - 38292792.0, - 38844242.0, - 39375920.0, - 39830750.0, - 40273338.0, - 40796466.0, - 41376056.0, - 41947152.0, - 42525850.0, - 43038714.0, - 43499066.0, - 43898434.0, - 44410592.0, - 44974340.0, - 45525104.0, - 46031946.0, - 46558498.0, - 47003838.0, - 47433372.0, - 47946490.0, - 48503014.0, - 49070278.0, - 49624240.0, - 50156348.0, - 50642786.0, - 51133818.0, - 51671828.0, - 52241780.0, - 52799910.0, - 53386224.0, - 53938534.0, - 54430532.0, - 54848698.0, - 55340090.0, - 55918458.0, - 56529842.0, - 57139234.0, - 57707416.0, - 58247392.0, - 58738432.0, - 59345478.0, - 59924910.0, - 60561282.0, - 61185218.0, - 61772228.0, - 62340886.0, - 62878764.0, - 63444184.0, - 64067146.0, - 64708922.0, - 65332126.0, - 65930660.0, - 66490372.0, - 66967394.0, - 67555274.0, - 68187292.0, - 68833632.0, - 69471214.0, - 70075038.0, - 70637074.0, - 71177914.0, - 71831426.0, - 72538674.0, - 73264760.0, - 73963218.0, - 74653792.0, - 75262828.0, - 75840302.0, - 76501664.0, - 77278342.0, - 78083082.0, - 78876896.0, - 79615168.0, - 80339580.0, - 81037390.0, - 81823820.0, - 82722006.0, - 83651126.0 + 78818.0, + 79341.0, + 80136.0, + 81003.0, + 82117.0, + 83388.0, + 85248.0, + 87073.0, + 89159.0, + 91017.0, + 93332.0, + 95689.0, + 98749.0, + 102869.0, + 106847.0, + 111026.0, + 115844.0, + 120962.0, + 128884.0, + 138358.0, + 148813.0, + 161013.0, + 173492.0, + 187733.0, + 204825.0, + 225119.0, + 256315.0, + 288303.0, + 322529.0, + 356799.0, + 401369.0, + 443905.0, + 497740.0, + 558849.0, + 624034.0, + 686888.0, + 744252.0, + 808965.0, + 883804.0, + 961451.0, + 1039097.0, + 1121096.0, + 1206366.0, + 1272626.0, + 1345891.0, + 1423285.0, + 1508343.0, + 1595776.0, + 1685399.0, + 1760764.0, + 1829287.0, + 1894542.0, + 1971519.0, + 2050331.0, + 2134761.0, + 2217038.0, + 2296734.0, + 2367237.0, + 2441893.0, + 2529214.0, + 2595818.0, + 2674605.0, + 2747755.0, + 2847602.0, + 2929436.0, + 2996209.0, + 3069037.0, + 3148547.0, + 3234220.0, + 3322751.0, + 3403382.0, + 3480405.0, + 3558014.0, + 3637659.0, + 3725872.0, + 3818688.0, + 3908386.0, + 3996804.0, + 4071338.0, + 4142709.0, + 4229828.0, + 4317318.0, + 4414502.0, + 4512733.0, + 4605707.0, + 4684758.0, + 4772709.0, + 4869087.0, + 4974060.0, + 5082845.0, + 5189648.0, + 5288602.0, + 5380854.0, + 5471805.0, + 5566445.0, + 5670258.0, + 5789590.0, + 5912776.0, + 6040542.0, + 6146167.0, + 6248939.0, + 6362151.0, + 6488667.0, + 6616019.0, + 6749876.0, + 6875263.0, + 6988931.0, + 7097681.0, + 7224452.0, + 7360113.0, + 7496841.0, + 7641831.0, + 7774800.0, + 7894416.0, + 8016008.0, + 8159259.0, + 8337287.0, + 8476097.0, + 8657451.0, + 8816587.0, + 8942873.0, + 9079367.0, + 9243544.0, + 9419365.0, + 9598233.0, + 9787933.0, + 9969180.0, + 10128250.0, + 10290065.0, + 10483861.0, + 10686099.0, + 10894983.0, + 11100783.0, + 11288556.0, + 11465105.0, + 11642267.0, + 11850778.0, + 12066690.0, + 12291651.0, + 12523371.0, + 12739090.0, + 12933283.0, + 13125836.0, + 13350890.0, + 13585178.0, + 13841329.0, + 14090156.0, + 14317176.0, + 14530804.0, + 14735440.0, + 14976976.0, + 15260866.0, + 15536707.0, + 15820994.0, + 16077984.0, + 16307327.0, + 16522674.0, + 16767378.0, + 17067354.0, + 17357579.0, + 17634843.0, + 17896865.0, + 18117778.0, + 18325098.0, + 18581908.0, + 18860444.0, + 19146396.0, + 19422121.0, + 19687960.0, + 19915375.0, + 20136669.0, + 20398233.0, + 20688028.0, + 20973576.0, + 21262925.0, + 21519357.0, + 21749533.0, + 21949217.0, + 22206541.0, + 22487170.0, + 22762552.0, + 23015973.0, + 23279249.0, + 23503456.0, + 23716686.0, + 23973245.0, + 24251507.0, + 24535139.0, + 24812120.0, + 25078174.0, + 25321393.0, + 25566909.0, + 25835914.0, + 26120890.0, + 26400955.0, + 26695862.0, + 26969267.0, + 27215266.0, + 27424349.0, + 27670045.0, + 27959229.0, + 28264921.0, + 28569617.0, + 28853708.0, + 29123696.0, + 29369216.0, + 29672739.0, + 29962455.0, + 30280641.0, + 30592609.0, + 30886114.0, + 31170443.0, + 31439382.0, + 31722092.0, + 32033573.0, + 32354461.0, + 32666063.0, + 32965330.0, + 33245186.0, + 33483697.0, + 33777637.0, + 34093646.0, + 34416816.0, + 34735607.0, + 35037519.0, + 35318537.0, + 35588957.0, + 35915713.0, + 36269337.0, + 36632380.0, + 36981609.0, + 37330339.0, + 37633977.0, + 37920151.0, + 38250833.0, + 38639176.0, + 39041618.0, + 39438626.0, + 39807835.0, + 40170040.0, + 40519089.0, + 40913370.0, + 41364278.0, + 41833755.0, + 42316351.0, + 42770115.0, + 43205040.0 ], "yaxis": "y" } diff --git a/web/covid_cases.png b/web/covid_cases.png index 15cc545..e87b470 100644 Binary files a/web/covid_cases.png and b/web/covid_cases.png differ diff --git a/web/covid_deaths.js b/web/covid_deaths.js index a40489e..1f974c2 100644 --- a/web/covid_deaths.js +++ b/web/covid_deaths.js @@ -239,7 +239,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { "2020-10-19", "2020-10-20", "2020-10-21", - "2020-10-22" + "2020-10-22", + "2020-10-23", + "2020-10-24", + "2020-10-25" ], "xaxis": "x", "y": [ @@ -399,13 +402,13 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 18.743879070978604, 18.919327632345606, 19.137331802214394, - 19.316513311695587, - 19.605443495734015, + 19.333684873020868, + 19.630080953287678, 19.883174835429866, 20.13626871757205, 20.39682849594262, 20.59616792524045, - 20.700690472437813, + 20.723088161122963, 20.904509439472672, 21.119527250850105, 21.359182519781204, @@ -417,7 +420,7 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 22.437257935159725, 22.61569285501808, 22.84116292111525, - 22.984508128700202, + 23.0136251239909, 23.17264871365546, 23.354816581628004, 23.514586760915403, @@ -453,8 +456,8 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 27.693248879941425, 27.87914969602816, 28.08819479042289, - 28.257670634807187, - 28.40176243201498, + 28.289027398966393, + 28.426399889568643, 28.531669026388844, 28.79596175287361, 28.990075054811566, @@ -464,7 +467,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 29.670218201217267, 29.812070229556547, 30.024848272065466, - 30.233146776837355 + 30.233146776837355, + 30.37947834291366, + 30.546714418429442, + 30.7154436731909 ], "yaxis": "y" }, @@ -701,7 +707,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { "2020-10-19", "2020-10-20", "2020-10-21", - "2020-10-22" + "2020-10-22", + "2020-10-23", + "2020-10-24", + "2020-10-25" ], "xaxis": "x", "y": [ @@ -918,15 +927,18 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 49.32797882959215, 49.69207806142816, 50.023153850515335, - 50.468099252179385, - 50.840357760086064, - 51.250326665794276, - 51.62995871517053, - 52.07089649505094, - 52.38838012346937, - 52.73240850117826, + 50.3885151247494, + 50.76018661097369, + 51.16950902873966, + 51.548542428952544, + 51.98878488547062, + 52.30576786777962, + 52.64925374044757, 53.11878207418384, - 53.516110623087066 + 53.516110623087066, + 53.89827074382431, + 54.28970045955189, + 54.65690282473658 ], "yaxis": "y" }, @@ -1163,7 +1175,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { "2020-10-19", "2020-10-20", "2020-10-21", - "2020-10-22" + "2020-10-22", + "2020-10-23", + "2020-10-24", + "2020-10-25" ], "xaxis": "x", "y": [ @@ -1387,8 +1402,11 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 289.66493228505936, 291.1324313445736, 292.75106434811016, - 294.780412497234, - 296.9332059288799 + 294.7815661914632, + 296.93435962310906, + 299.2094446430478, + 297.9998900968477, + 300.0041354924797 ], "yaxis": "y" }, @@ -1625,7 +1643,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { "2020-10-19", "2020-10-20", "2020-10-21", - "2020-10-22" + "2020-10-22", + "2020-10-23", + "2020-10-24", + "2020-10-25" ], "xaxis": "x", "y": [ @@ -1850,7 +1871,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 558.7961201833347, 560.0071292577792, 562.6405665886591, - 565.6359535591077 + 565.6359535591077, + 568.0630457683645, + 570.5341131674754, + 572.9612053767321 ], "yaxis": "y" }, @@ -2087,7 +2111,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { "2020-10-19", "2020-10-20", "2020-10-21", - "2020-10-22" + "2020-10-22", + "2020-10-23", + "2020-10-24", + "2020-10-25" ], "xaxis": "x", "y": [ @@ -2312,7 +2339,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 24.65404872292988, 24.67805461263088, 24.75007228173389, - 24.798084061135896 + 24.798084061135896, + 24.870101730238904, + 24.894107619939906, + 24.942119399341912 ], "yaxis": "y" }, @@ -2549,7 +2579,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { "2020-10-19", "2020-10-20", "2020-10-21", - "2020-10-22" + "2020-10-22", + "2020-10-23", + "2020-10-24", + "2020-10-25" ], "xaxis": "x", "y": [ @@ -2774,7 +2807,10 @@ if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { 649.5290898417787, 651.861472543314, 655.0394601286728, - 658.210478443011 + 658.210478443011, + 661.286250053402, + 664.2760673212067, + 666.7594508948532 ], "yaxis": "y" } diff --git a/web/covid_deaths.png b/web/covid_deaths.png index 33e88dc..49a6bb0 100644 Binary files a/web/covid_deaths.png and b/web/covid_deaths.png differ diff --git a/web/update_plots.py b/web/update_plots.py index f28cb63..3be524f 100755 --- a/web/update_plots.py +++ b/web/update_plots.py @@ -56,8 +56,8 @@ def update_confirmed_cases(): url = f'{BASE_URL}{id_}?period1=1579651200&period2={now}&interval=1d&events=history' return pd.read_csv(url, usecols=['Date', 'Close']).set_index('Date').Close covid = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv', - usecols=['date', 'total_cases']) - covid = covid.groupby('date').sum() + usecols=['location', 'date', 'total_cases']) + covid = covid[covid.location == 'World'].set_index('date').total_cases dow, gold, bitcoin = [scrape_yahoo(id_) for id_ in ('^DJI', 'GC=F', 'BTC-USD')] dow.name, gold.name, bitcoin.name = 'Dow Jones', 'Gold', 'Bitcoin' return covid, dow, gold, bitcoin