https://replit.com/@SaniAtiku/boilerplate-sea-level-predictor#sea_level_predictor.py

i am getting this error in the sea level predictor project.Any help?
FAIL: test_plot_lines (test_module.LinePlotTestCase)

Traceback (most recent call last):
File “/home/runner/boilerplate-sea-level-predictor/test_module.py”, line 38, in test_plot_lines
np.testing.assert_almost_equal(actual, expected, 7, “Expected different line for second line of best fit.”)
File “/home/runner/boilerplate-sea-level-predictor/venv/lib/python3.8/site-packages/numpy/testing/_private/utils.py”, line 583, in assert_almost_equal
return assert_array_almost_equal(actual, desired, decimal, err_msg)
File “/home/runner/boilerplate-sea-level-predictor/venv/lib/python3.8/site-packages/numpy/testing/_private/utils.py”, line 1046, in assert_array_almost_equal
assert_array_compare(compare, x, y, err_msg=err_msg, ver
 python main.py
/home/runner/boilerplate-sea-level-predictor/venv/lib/python3.8/site-packages/pandas/core/indexes/base.py:459: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
Deprecated in NumPy 1.20; for more details and guidance: NumPy 1.20.0 Release Notes — NumPy v1.24.dev0 Manual
elif issubclass(data.dtype.type, np.bool) or is_bool_dtype(data):
…F.

FAIL: test_plot_lines (test_module.LinePlotTestCase)

Traceback (most recent call last):
File “/home/runner/boilerplate-sea-level-predictor/test_module.py”, line 38, in test_plot_lines
np.testing.assert_almost_equal(actual, expected, 7, “Expected different line for second line of best fit.”)
File “/home/runner/boilerplate-sea-level-predictor/venv/lib/python3.8/site-packages/numpy/testing/_private/utils.py”, line 583, in assert_almost_equal
return assert_array_almost_equal(actual, desired, decimal, err_msg)
File “/home/runner/boilerplate-sea-level-predictor/venv/lib/python3.8/site-packages/numpy/testing/_private/utils.py”, line 1046, in assert_array_almost_equal
assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
File “/home/runner/boilerplate-sea-level-predictor/venv/lib/python3.8/site-packages/numpy/testing/_private/utils.py”, line 844, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 7 decimals
Expected different line for second line of best fit.
Mismatched elements: 51 / 51 (100%)
Max absolute difference: 5.20698827
Max relative difference: 0.33850202
x: array([ 7.0232261, 7.0862706, 7.1493152, 7.2123598, 7.2754044,
7.338449 , 7.4014936, 7.4645381, 7.5275827, 7.5906273,
7.6536719, 7.7167165, 7.7797611, 7.8428056, 7.9058502,…
y: array([ 7.0610799, 7.2275071, 7.3939344, 7.5603617, 7.726789 ,
7.8932162, 8.0596435, 8.2260708, 8.392498 , 8.5589253,
8.7253526, 8.8917799, 9.0582071, 9.2246344, 9.3910617,…


Ran 4 tests in 2.049s

FAILED (failures=1)

my code link: boilerplate-sea-level-predictor - Python Repl - Replit

Did you see this post? They have one of the errors (AssertionError) that you’re getting:

Also, check the NumPy link (in the error msg above) for the deprecated builtins in NumPy.
You can also ignore the warning. Here’s some documentation on that:
https://docs.python.org/3/library/warnings.html

Look at the produced image and you’ll notice that your second regression is just plotted over the first, but it should track with the data points that are above the original regression. The arrays are all the correct size (I tested that), but your two regressions are actually the same and the second must be for the recent sea level values only.

Fix the second regression for the recent values and you should be fine.