NameError: name 'np' is not defined

I got this error in exercise three in the week 3 practice lab on logistic regression Please help!!

Try to make sure the you run the code “import numpy as np”
It should be within the first code cells where you import all your libraries.

like, run the whole code from the start??

Yes. It must mean you missed where NumPy was imported.

Cell #UNQ_C4. Can’t compile the student’s code. Error: IndentationError(‘expected an indented block’, (‘/tmp/student_solution_cells/’, 39, 5, ’ m , n = X.shape \n’))
Now I’m getting this

This means your code has an indentation error.

Every time you open the notebook, you have to run all of the cells starting from the top. That’s where the packages are imported and the workspace is configured.

1 Like