-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-en.py
40 lines (27 loc) · 1.29 KB
/
main-en.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
import pandas as pd
dataset_pd = pd.read_csv(r'./COVID19_line_list_data.csv')
age_of_all_raw = dataset_pd['age'].tolist()
death_or_not_raw = dataset_pd['death'].tolist()
age_of_all = list()
for c in range(0, len(age_of_all_raw)):
if age_of_all_raw[c] in range(0, 150):
age_of_all.append(age_of_all_raw[c])
age_of_deaths = list()
for c in range(0, len(age_of_all_raw)):
if age_of_all_raw[c] in range(0, 150) and death_or_not_raw[c] in (1, '1'):
age_of_deaths.append(age_of_all_raw[c])
import matplotlib.pyplot as plt
plt.title('BOXPLOT - Age comparation between total cases \nand death cases in COVID-19 patients')
plt.ylabel('Age of patients')
plt.xlabel('Total number of analyzed patients: 1085')
plt.grid('True')
bplot = plt.boxplot([age_of_all, age_of_deaths], labels=['', ''], patch_artist=True)
bplot['boxes'][0].set_facecolor('lightblue')
bplot['boxes'][1].set_facecolor('pink')
import matplotlib.patches as mpatches
lightblue_patch = mpatches.Patch(color='lightblue', label='Total cases')
pink_patch = mpatches.Patch(color='pink', label='Death cases')
plt.legend(handles=[lightblue_patch, pink_patch], loc='lower center')
#plt.show()
plt.savefig(dpi=400, fname='BOXPLOT Age comparation between total cases and death cases in COVID-19 patients.png'.replace(' ', '-'))