-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode11.py
More file actions
34 lines (26 loc) · 1.07 KB
/
Code11.py
File metadata and controls
34 lines (26 loc) · 1.07 KB
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
import pandas as pd
data = pd.read_csv("Week13Assignment.txt")
age_avg = data[" Age"].mean()
male = 0
female=0
for gender in data[" Gender"]:
if gender == "male":
male += 1
elif gender=="female":
female += 1
systolic = list()
diastolic= list()
for bp in data[" BloodPressure"]:
sys, dia = bp.split("/")
systolic.append(int(sys))
diastolic.append(int(dia))
systolic_avg = sum(systolic)/len(systolic)
diastolic_avg= sum(diastolic)/len(diastolic)
temp_avg = data[" Temperature"].mean()
print("-- Patients' Data Statistics --")
print(f"The average age of the patients is {age_avg}.")
print(f"The number of male and female patients is {male} and {female} respectively.")
print(f"The blood pressures have an average systolic pressure of {systolic_avg} and average diastolic pressure of {diastolic_avg}.")
print(f"The highest and lowest systolic pressures are {max(systolic)} and {min(systolic)}.")
print(f"The highest and lowest diastolic pressures are {max(diastolic)} and {min(diastolic)}.")
print(f"The average patient temperature is {temp_avg} celsius.")