Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicting Life Expectancy-Solution #41

Open
otles2 opened this issue Jul 17, 2023 · 0 comments
Open

Predicting Life Expectancy-Solution #41

otles2 opened this issue Jul 17, 2023 · 0 comments

Comments

@otles2
Copy link

otles2 commented Jul 17, 2023

In the following solution, y equation does not reflect the printed statements


Use the linear equation you’ve just created to predict life expectancy in Germany for every year between 2001 and 2016. How accurate are your answers? If you worked for a pension scheme would you trust your answers to predict the future costs for paying pensioners?


Given solution --
df = pd.read_csv('../data/gapminder-life-expectancy.csv',index_col="Life expectancy")
for x in range(2001,2017):
y = 0.215621719457 * x - 351.935837103
real = df.loc['Germany', str(x)]
print(x, "Predicted", y, "Real", real, "Difference", y-real)

y equation should be
y=0.212219909502 * x - 346.784909502

df = pd.read_csv('../data/gapminder-life-expectancy.csv',index_col="Life expectancy")
for x in range(2001,2017):
y=0.212219909502 * x - 346.784909502
real = df.loc['Germany', str(x)]
print(x, "Predicted", y, "Real", real, "Difference", y-real)

please review, thanks

Zekai Otles


Thanks for contributing! If this contribution is for instructor training, please send an email to [email protected] with a link to this contribution so we can record your progress. You’ve completed your contribution step for instructor checkout just by submitting this contribution.

If this issue is about a specific episode within a lesson, please provide its link or filename.

Please keep in mind that lesson maintainers are volunteers and it may be some time before they can respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact Kate Hertweck ([email protected]).


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant