Programming Assignment: NYC Restaurant Inspections

To Create a post, follow these guidelines:

  1. A clear title for the post
  2. Include one of these tags per post (in the tag option)
  • daily-streak
  • course-topics
  • social-sharing
  • recommendation

Hi all, issues here:

Help please,

Cam

N.B.I suspect grading issues.

Hi Cam!

The error ‘NoneType’ object has no attribute ‘columns’ happens when your variable is None, but you’re trying to use it like a DataFrame.

Did your outputs for exercises 6 to 8 match the ‘expected_output’? If so, I would suggest saving your lab and then submitting it again for evaluation.

I completed this lab to be able to answer you, and when I submitted it only with solutions up to exercise 6, I also had the issue that you encountered. But then I finished the lab (without any modification to exercise 6), and then submitted it again, I was able to get scored.

HI imgabidotcom, thanks for the instructions. I’ll give it a bash.

HI imgabidotcom, I appreciate your help but I have tried multiple times-still get

as below,I am at the end of my tether.

Exercise 6

Filename: Exercise 6

0/10Score: 0 of 10

Hide grader output

Grader output

There was an error grading your submission. Details: ‘NoneType’ object has no attribute ‘columns’

Exercise 7

Filename: Exercise 7

0/10Score: 0 of 10

Hide grader output

Grader output

There was an error grading your submission. Details: ‘NoneType’ object has no attribute ‘columns’

Exercise 8

Filename: Exercise 8

0/10Score: 0 of 10

Hide grader output

Grader output

There was an error grading your submission. Details: ‘NoneType’ object has no attribute ‘columns’

Let’s see if @rmwkwok can help us here then.

→ I am assuming his SQL query is returning empty because of the error Cam is getting. I followed this lab to try to reproduce the issue. When I submitted only until exercise 6 (the first one he had the issue), I had the same error. This is expected for exercises 7 and 8, but not for 6. I continued the lab and finished 7 and 8 as well (without editing anything in 6), and received full marks. I am unsure how can I help further since I am not able to reproduce the error. Do you have any suggestions?

This is regarding the Capstone project for course 4.

@CamLiv8 I asked another mentor for assistance as you see above. In the meanwhile can you please confirm that the file restaurant_data.db exists? If you follow the instructions on the lab, you will create this file on Step 05. Then on step 06, before the part you have to code, you have a locked cell that tests if the connection exists and returns one row to test.

Hello Gabi @imgabidotcom,

I am just thinking about exercise 6, because I prefer to deal with them one-by-one.

The error is likely complaining that scores_by_cuisine_df is a NoneType, however, pd.read_sql_query should never return a None, according to the documentation.

Even if there was an error in the SQL query, if we run that code cell on Jupyter, we could see an error message that explains what’s failing the query, and then we can start investigation from that error message.

However, the problem is, as explained above, scores_by_cuisine_df should not be None in the first place, so I would be wondering if the following last line of exercise 6 was changed into something else:

image

Cheers,
Raymond

Thank you for pointing out @rmwkwok!

@CamLiv8 Can I kindly ask you to restart your notebook for this assignment as well? If you have the same issue again, we can ask someone to check the grader.

As mentioned above, I only faced this issue in situations where the notebook wasn’t complete, or the SQL query didn’t run because there was a mistake (in the query).

I submitted the assignment again now and the grader worked as expected.