Consider the file “PatientTemperature_CSV.csv” given to you representing patient body temperatures at a hospital on a particular day. The data is organized into two columns: patient temperature and patient age. Using code snippets available from the class lecture material or otherwise, perform the following tasks with this data in python: [80 points]
a) Read the data into Python [15 points]
b) Determine the mean, mode, median, variance, and standard deviation for the patient temperatures. [15 points]
c) Determine the mean, median, variance, and standard deviation for the patient ages. [15 points]
d) Determine the probability that a patient would have a body temperature greater than or equal to 97 F and lesser than or equal to 98 F. [15 points]
e) Plot a histogram of the temperature data. Please include a title and proper axes labels.[20 points]
sample data
#PatientTemperature.csv
PatientTemperature,PatientAge
90,70
90,37
95,63
102,60
90,58
90,45
100,52
91,81
90,54
92,56
101,39
98,41
96,65
97,86
99,57
92,65
103,45
100,82
99,52
97,53
92,59
92,76
101,66
92,64
92,55
92,67
103,67
95,19
95,47
103,33
93,18
98,59
94,30
103,88
97,57
91,79
103,49
96,57
90,78
100,60
95,25
94,20
90,29
92,25
99,76
92,18
102,86
99,49
99,80
92,22
99,84
92,19
96,87
90,54
98,69
95,72
97,39
99,80
92,41
93,71
99,42
92,32
102,30
96,71
92,86
99,90
103,59
99,88
99,39
94,37
90,37
93,77
99,52
95,60
98,18
101,46
100,62
101,90
90,28
96,30
95,67
101,64
103,51
94,18
102,19
98,51
95,73
96,85
95,36
92,21
99,90
100,62
97,78
99,45
98,45
90,23
90,21
92,81
94,85
95,36
98,29
100,30
100,48
92,57
90,77
101,40
102,90
95,89
99,71
100,20
96,37
99,50
90,28
90,37
90,82
100,41
90,53
101,59
97,51
95,84
90,69
98,72
101,68
91,39
95,29
92,70
96,72
102,46
91,86
90,86
100,65
94,86
96,27
99,46
91,19
94,62
90,51
96,18
102,21
93,74
#source code:
import numpy as np
from scipy import stats
import pandas as pd
import matplotlib.pyplot as plt
data=pd.read_csv("PatientTemperature.csv") #read the data into data
dataframe
print(data) #print the data
#mean,meadian,mode,variance,standard deviation of patientTemperature
print("Mean
Temperature:",np.mean(data['PatientTemperature']))
print("Median
Temperature:",np.median(data['PatientTemperature']))
print("Mode
Temperature:",stats.mode(data['PatientTemperature']))
print("variance
Temperature:",np.var(data['PatientTemperature']))
print("standard deviation
Temperature:",np.std(data['PatientTemperature']))
print("\n")
#mean,meadian,mode,variance,standard deviation of patientage
print("Mean Age:",np.mean(data['PatientAge']))
print("Median Age:",np.median(data['PatientAge']))
print("Mode Age:",stats.mode(data['PatientAge']))
print("variance Age:",np.var(data['PatientAge']))
print("standard deviation Age:",np.std(data['PatientAge']))
#probability of the patientTemperature
size=data.shape
data_count=size[0]
count_p=0
for i in range(data_count):
if(data['PatientTemperature'][i]>=97 and
data['PatientTemperature'][i]<=98):
count_p+=1
print("Probability:",count_p/data_count)
#histogram
plt.bar(data['PatientTemperature'],data['PatientAge'])
plt.xlabel("Temperature")
plt.ylabel("Age")
plt.show()
#output:
#if you have any doubts comment below..if you like give thumbs up...
Get Answers For Free
Most questions answered within 1 hours.