Pulse

Pulse measures the frequency of the heartbeat in the patient. The normal range is 60-100. Having a pulse faster than 100 is termed tachycardia and usually indicates some underlying cardiac dysfunction, volume depletion, or infection (sepsis). A pulse lower than 60 is termed bradycardia.

We must use mean imputation to impute the missing values. First, we convert the pulse to a numeric type:

X_train.loc[:,'PULSE'] = X_train.loc[:,'PULSE'].apply(pd.to_numeric)
X_test.loc[:,'PULSE'] = X_test.loc[:,'PULSE'].apply(pd.to_numeric)

Then, we write a mean_impute_vitals() function that is similar to our mean_impute_values() function, except that the placeholder values have been changed from -7 and -9 to -998 and -9:

def mean_impute_vitals(data,col): 
temp_mean = data.loc[(data[col] != 998) & (data[col] != -9), col].mean()
data.loc[(data[col] == 998) | (data[col] == -9), col] = temp_mean
return data

X_train = mean_impute_vitals(X_train,'PULSE')
X_test = mean_impute_vitals(X_test,'PULSE')
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset