Name 'data' is not defined : Guided project Prison break

for row in data :
date = fetch_year(row[0])
row[0] = date

Screen Link:

My Code:

for row in data :
    date = fetch_year(row[0])
    row[0] = date

What I expected to happen:
I expected the data to be recognised

What actually happened:

NameError                                 Traceback (most recent call last)
<ipython-input-14-a6dd1db0d31d> in <module>
----> 1 for row in data :
      2     date = fetch_year(row[0])
      3     row[0] = date

NameError: name 'data' is not defined

I have used the reference for data in the previous code lines and seems to have worked, but in this line it is not working, Not sure why ? Can some one give me some perspective on this name not defined error. I understand that there is some gap in my definition of the data and hence this error, but if some one can help me with good practices to avoid this error, I will be grateful.

Hi @arjnath, Kindly can you share your notebook so we help better and hope you followed in instructions from the first screen of the lesson which says you should import *.

Hi @arjnath,

If you feel that Ā your questionĀ was successfully solved, could you please mark the helpful answer asĀ Solution? You can findĀ hereĀ how to do it technically (in theĀ GUIDELINEĀ #5). Please consider this practice also for any other questions you might ask in the Community. This would be of great help both to your helpers and the other learners who can have the same questions in the future.

Many thanks and happy learning!Ā 

:rotating_light: NOTE: This is an automated message. Please do not reply. :rotating_light:

Hi arjnath,

You may need to rerun all the cells in your Jupyter notebook. Go to Run and Run all cells.


This was very helpful. Thank you very much @casandra

1 Like