In [8]:
import pandas as pd
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
%matplotlib inline
In [6]:
df = pd.read_csv('heights_weights_genders.csv')
df.head()
Out[6]:
In [7]:
df.plot(kind='scatter', x="Height", y="Weight")
Out[7]:
In [9]:
lm = smf.ols(formula="Weight~Height",data=df).fit()
In [10]:
lm.params
Out[10]:
In [26]:
height_input = input('Please tell me your height in inches:')
if height_input:
if height_input <= "0":
print("Something went wrong with data input. Please try again - add in a value bigger than 0!")
else:
output = (7.717288 * int(height_input)) + (-350.737192)
print("I guess your weight might be approximately", output, "pounds. No offense, if it's incorrect; I'm just a simple algorithm ¯\_(ツ)_/¯")
In [ ]:
In [ ]: