+ 1
Come on, i want to make BMI with pandas, where is my bug??
3 ответов
+ 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)
+ 2
I can't really see a bug here.
0
Okay, I get it, because my height is centimeter, not Meters, thanks bro