Capstone: NYC Restaurant Inspections. Ex. 4

I am having trouble with exercise 4 of the capstone i forwarded my feedback error message with no respond and I’m stocked. Please kindly help below is the error I got.

Hi @shofagbile :waving_hand:t4:

From your screenshot, I see you have a KeyError issue, which indicates you’re trying to access a column/index that doesn’t exist (it is coming from the line where you try to index possible_price_level inside the loop).
Try to revise your logic and/or perform some simple print statements and I believe you will be able to tackle this. If you’re still stuck, let us know :slight_smile:

Hi @imgabidotcom
I think I’m confused or something because I created the column possible_price_level. I am still stuck on this exercise.
Thanks

Hello, @shofagbile,

I could only recommend a way for you to inspect your code. For example, I have added some print to look at what the variables are containing.

In the in-line comments, I put down the expected printout, which I will elaborate with the following example as I think the Directions may not be clear enough: possible_price_level should be a “list” instead of a “column” (my understanding of your “column” is that it was a pandas object like Series). The list should contain the price_level column’s values in the sequence stated in the Directions. For example, " - No ratings yet" should be the last in the list. The list, therefore, should contain only 6 elements.

Since excessive printing can cause problem, I added do_print to safeguard it, but you may adjust it as you need.

Btw, @shofagbile, for screenshot that is shared with us, please get rid of the “Save File As” dialogue before taking it, because it may cover up some important details that may help our discussion.

Cheers,
Raymond

Hi @rmwkwok,
Thank you for your help, all good now.
I have my certificate.

Cheers
Shola

1 Like

That’s good news, Shola, and congratulations on your achievement!

Cheers,
Raymond