+ 1

Come on, i want to make BMI with pandas, where is my bug??

https://code.sololearn.com/cCo879Ub0Bdg/?ref=app

30th Mar 2021, 6:14 AM
Yohanes Prasdya
Yohanes Prasdya - avatar
3 Respostas
+ 5
It looks like your height unit is off. You're using cm but BMI is calculated with meters. The below code outputs more normal BMI values from 17 to 40. import pandas as pd data = { 'Weight' : [56,60,45,80], # kg 'Height' : [1.80,1.75,1.60,1.45] # meters } a = pd.DataFrame(data, index = ['Joni','Bejo','Rembo','Bigo']) print(a) b = a["Weight"]/(a["Height"]**2) print(b)
30th Mar 2021, 6:22 AM
Josh Greig
Josh Greig - avatar
+ 2
I can't really see a bug here.
30th Mar 2021, 6:21 AM
Michael
Michael - avatar
0
Okay, I get it, because my height is centimeter, not Meters, thanks bro
30th Mar 2021, 6:45 AM
Yohanes Prasdya
Yohanes Prasdya - avatar