# Sea Level Predictor:Expected different line for first line of best fit

Hi. I have this code and it seems to work fine, but I always get this errors.

def draw_plot():

``````# Create scatter plot using the "Year" column as the x-axis and the "CSIRO Adjusted Sea Level" column as the y-axix.
fig, ax = plt.subplots(figsize=(10,5))

# Create first line of best fit

# Use the linregress function from scipy.stats to get the slope and y-intercept of
# the line of best fit. Plot the line of best fit over the top of the scatter plot.
# Make the line go through the year 2050 to predict the sea level rise in 2050.
x = df['Year']
y = df['CSIRO Adjusted Sea Level']

slope, intercept, r_value, p_value, std_err = linregress(x,y)
``````

# Dummy variable to calculate First best fit line

``````x1 = list(range(1880, 2050))
y1 = []

for year in x1:
y1.append(intercept + slope * year)

ax1 = plt.plot(x1, y1, 'r', label = 'Best Fit Line 1', color='red')
plt.legend()

# Create second line of best fit
xx = df[ df['Year'] >= 2000 ]['Year']
yy = df[ df['Year'] >= 2000 ]['CSIRO Adjusted Sea Level']

fit2 = linregress(xx, yy)
new_slope = fit2.slope
new_intercept = fit2.intercept

x2 = list(range(2000, 2050))
y2 = []

for year in x2:
y2.append(new_intercept + new_slope * year)

ax2 = plt.plot(x2, y2, 'r', label = 'Best Fit Line 2', color='green')
plt.legend()

ax.set_xlabel('Year')
ax.set_ylabel('Sea Level (inches)')
plt.title('Rise in Sea Level')

# Save plot and return data for testing (DO NOT MODIFY)
plt.savefig('sea_level_plot.png')
return plt.gca()
``````

User Agent is: `Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36`.