Guided Project: Cell is not recognizing earlier code

Hi,

I was working on the Data Science for Python first Guided Project : Profitable Apps

I had gotten to the end of Removing Data Entries: Part Two, and the cell number on the left had gotten to In [34].

However, now that I want to proceed with the project, when I try to run a new code in a cell below this one, shows it has started numbering from 1 again, i.e. In [1]. so now it’s not recognizing any of the work / code above.

i.e. it says all the previously defined variables are undefined. So it’s not picking up the earlier code. I don’t want to use “Run All” option, because I deleted a row earlier as part of the exercise:

del android[10472] # don’t run this more than once

Please help, I’m not sure what to do, and I don’t want to start from scratch.

Hi Kay,

Regarding the:

del android[40172] # don't do this more than once

You don’t want to do this more than once in a row after you read in your data set. Because when you run all cells you read in the dataset fresh, you actually want to delete this again.

Running all cells should be fine and will almost certainly fix your problem.

By way of explanation, what might have happened is that you left the Jupyter session and came back. When you do this, your code and outputs will look the same, but the Python kernel that runs your code starts fresh, and so it doesn’t remember any of the variable state. This is why you have to run all the cells again, to get that state back into the kernel.

I hope this helps,

Ah indeed, I didn’t think about it like that!

Have now done as suggested and problem fixed :slight_smile:

Thanks a lot Josh, really appreciated!