Numpy Error in Sea Level Predictor

Hello everyone,
I have been trying to upload my code but when I run it the message is the following:
‘module numpy has no attribute bool’.

This is my code:

def draw_plot():
    # Read data from file
  df = pd.read_csv('epa-sea-level.csv')
    # Create scatter plot
  ax.scatter(data=df, x='Year', y='CSIRO Adjusted Sea Level')
    # Create first line of best fit
  x = df.Year
  y=df['CSIRO Adjusted Sea Level']
  slope, intercept, r, p, se = linregress(x, y)
  years_to_2050 = pd.Series(range(1880,2051))
  ax.plot(years_to_2050, intercept+slope*years_to_2050, 'g')
    # Create second line of best fit
  new_df = df[df.Year>=2000]
  new_x = new_df.Year
  new_y = new_df['CSIRO Adjusted Sea Level']
  new_slope, new_intercept, new_r, new_p, new_se = linregress(new_x, new_y)
  new_to_2050 = years_to_2050[years_to_2050>=2000]
  ax.plot(new_to_2050, new_intercept+new_slope*new_to_2050, 'y')

    # Add labels and title
  ax.set_title('Rise in Sea Level')
  ax.set_ylabel('Sea Level (inches)')
    # Save plot and return data for testing (DO NOT MODIFY)
  return plt.gca()

What should I do? When I run it on my Jupyter Notebook it works fine.

Many thanks in advance.

Could you include the full traceback from the error?

I don’t have it now. Tomorrow I’ll send.
It starts and has problem in importing libraries.

It’s likely a dependency issue. I copied and ran your code locally without error. Try removing and reinstalling your dependencies as described in other posts about the python data analysis projects.

Otherwise, post the full error as @sanity indicated and/or the link to your repl so that others can generate the error.

How can I solve it?
How can I remove and install the dependencies?

At this point, you’ll need to provide more information, like a link to your repl, because the answer is platform dependent.

If you’re on replit, then this is a common issue and there are several posts in the forums with details that are just a search away.
This is my replit link. I have submitted it anyway. I will wait for their reply.

What do you mean by “I have submitted it anyway”?

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