Data Analysis with Python Projects - Sea Level Predictor

Tell us what’s happening:
I created a scatter plot based on the year and CSIRO Adjusted sea level being the x and y axis respectively. The next part of the task requires me to use linregress on x and y and created a fitted line onto the scatter plot which I managed. However I need to extrapolate the fitted line to 2050 whereas data was only available from 1880 to 2013. I tried to figure out the CSIRO Adjusted Sea Level of 2050 and append to the dataframe but when trying to plot, the fitted line does not extend to 250 or I am met with this error.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

Challenge: Data Analysis with Python Projects - Sea Level Predictor

Link to the challenge:

You can plot a line with the slope and intercept from linregress() without appending anything to your data frame. You can also create a linear function to calculate the predicted level for each year.

Please post links to repls for debugging and use code blocks for code/errors so that they are indexable and searchable.

Hi Jeremy, yes I was able to plot using linregress(x, y) where x was the year column from dataframe and y was the sea level column. However I am unsure how to implement the part about creating a linear function to calculate the predicted level for each year. Does that mean I use the linregress slope and intercept to calculate for each year leading up to 2050 and append to dataframe than plot from there or something else?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.