File:Suomen korona epidemia parantuneita sairaana kuolleita tapauksia kevat 2020 1.svg
Original file (SVG file, nominally 1,099 × 497 pixels, file size: 73 KB)
Captions
Summary
editDescriptionSuomen korona epidemia parantuneita sairaana kuolleita tapauksia kevat 2020 1.svg |
English: Coronavirus epidemy in Finland
Recovered,, green sick, red, dead, black, cases yellow. dates are month-day in spring 2020. |
Date | |
Source | Own work |
Author | Merikanto |
This image is produced with Python script. Data comes from net github Covid-19 aggregate site
- COVID-19 statistics from aggregated data from net site
- with Python
- Input from internet site: cases, recovered, deats.
- Calculates active cases.
-
- 12.1.2021
- 0002.0001
-
import math as math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import locale
from datetime import datetime, timedelta
import matplotlib.ticker as ticker
import matplotlib.dates as mdates
from matplotlib.ticker import (MultipleLocator, FormatStrFormatter,
AutoMinorLocator)
def format_func(value, tick_number):
N = int(np.round(value/10))
if N == 0:
return "0"
else:
return r"${0}\pv$".format(N)
dfin = pd.read_csv('https://datahub.io/core/covid-19/r/countries-aggregated.csv', parse_dates=['Date'])
countries = ['Finland']
dfin = dfin[dfin['Country'].isin(countries)]
- print(dfin)
- quit()
selected_columns = dfin"Date", "Confirmed", "Recovered", "Deaths"
df2 = selected_columns.copy()
df2.to_csv (r'kovadata1.csv', index = True, header=True, sep=';')
- sektion 2
- draw estimeted active cases, smoothed
df = pd.read_csv(r'kovadata1.csv', delimiter=';')
- print (df["Date"])
dates=df['Date']
locale.setlocale(locale.LC_TIME, "fi_FI")
dates_a = [datetime.strptime(d,'%Y-%m-%d').date() for d in dates]
len1=len(df["Date"])
aktiv2= [None] * len1
for n in range(0,len1-1):
aktiv2[n]=0
- print( len1)
- index1=df['Index']
dates=df['Date']
rekov1=df['Recovered']
konf1=df['Confirmed']
death1=df['Deaths']
spanni=6
rulla = rekov1.rolling(window=spanni).mean()
rulla2 = rulla.rolling(window=spanni).mean()
tulosrulla=rulla2
- print (rulla)
x=np.linspace(0,len1,len1);
for n in range(0,(len1-1)):
rulla2[n]=round(tulosrulla[n],0)
aktiv2[n]=konf1[n]-death1[n]-rulla2[n]
dailycases1= [0] * len1
dailydeaths1= [0] * len1
for n in range(1,(len1-1)):
dailycases1[n]=konf1[n]-konf1[n-1]
for n in range(1,(len1-1)):
dailydeaths1[n]=death1[n]-death1[n-1]
fig, ax = plt.subplots(constrained_layout=True)
ax.legend(fontsize=14)
secax = ax.secondary_xaxis('top')
- secax.set_xlabel('paivia')
dates2= [None] * len1
dates3= [None] * (int(len1/10)+1)
plt.xticks(fontsize=14)
plt.yticks(fontsize=14, rotation=0)
ax.set_xlabel('pvm', color='g',size=18)
ax.set_ylabel('luku', color='g',size=18)
ax.set_title('Koronavirusepidemia', color='b',size=22)
- ax.plot(x, rekov1,'g-',linewidth=4.0, label='parantuneita')
- ax.plot(x, aktiv2,'r-',linewidth=4.0, label='sairaana')
- ax.plot(x, death1,'k-',linewidth=4.0, label='kuolleita')
- ax.plot(x, konf1,'y.-',linewidth=4.0, label='tapauksia')
ax.plot(dates_a, rekov1,'g-',linewidth=4.0, label='parantuneita')
ax.plot(dates_a, aktiv2,'r-',linewidth=4.0, label='sairaana')
ax.plot(dates_a, death1,'k-',linewidth=4.0, label='kuolleita')
ax.plot(dates_a, konf1,'y.-',linewidth=4.0, label='tapauksia')
dateformat1 = mdates.DateFormatter('%d.%m')
ax.xaxis.set_major_formatter(dateformat1)
ax.legend(fontsize=14)
plt.show()
plt.savefig('kuva.svg')
for n in range(0,(len1-1)):
luku0=aktiv2[n]
luku1=luku0.astype(float)
if(math.isnan(luku0)):
aktiv2[n]=0
aktiv2[len1-1]=0
aktiv3a = np.array(aktiv2)
- print(aktiv2)
- print(aktiv3a)
aktiv3=aktiv3a.astype(int)
- print(aktiv3)
print(df)
- df.drop(1, axis=1)
df.insert (2, "Daily_Cases", dailycases1)
df.insert (3, "Daily_Deaths", dailydeaths1)
- quit()
df['ActiveEst']=aktiv3
dfout = df'Date', 'Confirmed','Deaths','Recovered', 'ActiveEst','Daily_Cases','Daily_Deaths'
print(dfout)
dfout.to_csv (r'kovadata2.csv', index = True, header=True, sep=';')
Licensing
edit- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 10:20, 18 September 2020 | 1,099 × 497 (73 KB) | Merikanto (talk | contribs) | Update of script | |
07:29, 2 September 2020 | 830 × 463 (80 KB) | Merikanto (talk | contribs) | Update | ||
15:26, 14 August 2020 | 967 × 476 (77 KB) | Merikanto (talk | contribs) | Update | ||
11:53, 28 July 2020 | 770 × 474 (71 KB) | Merikanto (talk | contribs) | Update of image | ||
09:52, 26 May 2020 | 756 × 432 (65 KB) | Merikanto (talk | contribs) | maybe betetr layout of image | ||
15:26, 25 May 2020 | 716 × 432 (69 KB) | Merikanto (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 879.12pt |
---|---|
Height | 397.44pt |