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

Captions

Coronavirus epidemy in finnish recovered ill dead cases

Summary

edit
Description
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



    1. COVID-19 statistics from aggregated data from net site
    2. with Python
    3. Input from internet site: cases, recovered, deats.
    4. Calculates active cases.
    5. 12.1.2021
    6. 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)]


  1. print(dfin)
  1. quit()

selected_columns = dfin"Date", "Confirmed", "Recovered", "Deaths"

df2 = selected_columns.copy()

df2.to_csv (r'kovadata1.csv', index = True, header=True, sep=';')

    1. sektion 2
      1. draw estimeted active cases, smoothed

df = pd.read_csv(r'kovadata1.csv', delimiter=';')

  1. 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


  1. print( len1)
  1. 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


  1. 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')

  1. 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)

  1. ax.plot(x, rekov1,'g-',linewidth=4.0, label='parantuneita')
  2. ax.plot(x, aktiv2,'r-',linewidth=4.0, label='sairaana')
  3. ax.plot(x, death1,'k-',linewidth=4.0, label='kuolleita')
  4. 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)

  1. print(aktiv2)


  1. print(aktiv3a)

aktiv3=aktiv3a.astype(int)

  1. print(aktiv3)


print(df)

  1. df.drop(1, axis=1)

df.insert (2, "Daily_Cases", dailycases1) df.insert (3, "Daily_Deaths", dailydeaths1)

  1. 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
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
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/TimeThumbnailDimensionsUserComment
current10:20, 18 September 2020Thumbnail for version as of 10:20, 18 September 20201,099 × 497 (73 KB)Merikanto (talk | contribs)Update of script
07:29, 2 September 2020Thumbnail for version as of 07:29, 2 September 2020830 × 463 (80 KB)Merikanto (talk | contribs)Update
15:26, 14 August 2020Thumbnail for version as of 15:26, 14 August 2020967 × 476 (77 KB)Merikanto (talk | contribs)Update
11:53, 28 July 2020Thumbnail for version as of 11:53, 28 July 2020770 × 474 (71 KB)Merikanto (talk | contribs)Update of image
09:52, 26 May 2020Thumbnail for version as of 09:52, 26 May 2020756 × 432 (65 KB)Merikanto (talk | contribs)maybe betetr layout of image
15:26, 25 May 2020Thumbnail for version as of 15:26, 25 May 2020716 × 432 (69 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

The following page uses this file:

Metadata