Generation

generate functionMon, 13 Feb 2023

Modify the formula below so that it rounds to the nearest integer: df2['respiratory_rate'] = df2['respiratory_rate'].fillna( df2.groupby('pulse')['respiratory_rate'].transform('median'))

def round_to_nearest_integer(x): return round(x) df2['respiratory_rate'] = df2['respiratory_rate'].fillna( df2.groupby('pulse')['respiratory_rate'].transform(round_to_nearest_integer))

Questions about programming?Chat with your personal AI assistant