Modify the formula below so that it rounds to the nearest integer, but not less than 1 and not more than 4: df2['respiratory_rate'] = df2['respiratory_rate'].fillna( df2.groupby('pulse')['respiratory_rate'].transform('median'))
def calculate_respiratory_rate(pulse, respiratory_rate): if respiratory_rate == respiratory_rate: return respiratory_rate else: return pulse/pulse + 0.5 calculate_respiratory_rate(60, np.nan) calculate_respiratory_rate(60, 12)