FAQ: Exploring Data with Python - Summarizing Categorical Data

This community-built FAQ covers the “Summarizing Categorical Data” exercise from the lesson “Exploring Data with Python”.

Paths and Courses
This exercise can be found in the following Codecademy content:

[Beta] Getting Started with Python for Data Science

FAQs on the exercise Summarizing Categorical Data

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in Language Help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

Looking for motivation to keep learning? Join our wider discussions in Community

Learn more about how to use this guide.

Found a bug? Report it online, or post in Bug Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hello! I am stuck on this exercise on “Summarizing Categorical Data.” I have tried this numerous times and I don’t know what the issue is. I copy/pasted the code from the solution and I am still getting an error.

Question 2. Assign the value counts of the different repair_status values to the variable status_counts.

YOUR SOLUTION HERE

status_counts = repair[‘repair_status’].value_counts()

show output

status_counts

NameError Traceback (most recent call last)
Cell In[1], line 2
1 ## YOUR SOLUTION HERE ##
----> 2 status_counts = repair[‘repair_status’].value_counts()
3 # show output
4 status_counts

NameError: name ‘repair’ is not defined

Modify .value_counts() on the repair_status column to return percents, and assign the result to status_percents

YOUR SOLUTION HERE

status_percents = repair[‘repair_status’].value_counts(normalize=True)

show output

status_percents

NameError Traceback (most recent call last)
Cell In[2], line 2
1 ## YOUR SOLUTION HERE ##
----> 2 status_percents = repair[‘repair_status’].value_counts(normalize=True)
5 # show output
6 status_percents

NameError: name ‘repair’ is not defined

What am I missing?

Since repair is not being recognized when you try to complete the step, it is quite likely that you may have reloaded the page/exercise but failed to run the Setup cell to import libraries and datasets (the cell at the very top of the notebook).

First of all, run the Setup cell and save. Then work from top to bottom running each cell and saving as you work through the exercise. When you need to complete a step, then click the “Test Work” button.

2 Likes

Thank you so much for these suggestions. I will give it a try. With Gratitude!

1 Like

I followed up with your suggestion and ran the SetUp cell once again and saved it. Everything worked this time. Thank you so much.

1 Like

Side question: I completed and ran all the steps with expected output on each step, yet I’m not getting a checkmark for the first step, so all the others are still grayed out. Did you get all your checkmarks?

Did you change the default of “Not Trusted” to “Trusted” on the Jupyter Notebook? Maybe that would fix it.(?)

Edit: I tried and that didn’t fix it. Seems to be a buggy notebook/lesson. My code is correct, but it doesn’t result in the green checkmark. :woman_shrugging:

I haven’t reset progress to check whether the notebook is still working.

But, when I completed the exercise, the sequence was: Run the cell, Click the “Save and Checkpoint” button, then click the “Test Work” button at the bottom to complete a step.

If it isn’t working now, it may be a recent thing. It was working when I completed the exercise. Just don’t want to reset progress to confirm it.

1 Like

Still no love. I’ve reset the exercise and will try again. It looks like it is trying to insert the check mark (little wheel in box) but then it stops without checking, and there are no errors reported.

@lisalisaj, did you get it to work?

Off topic, Update

After resetting I took a minute to consider my previous code. The issue was that I had used print statements rather than leaving the second line alone. D’oh! Got through the first step, now on the rest.

2 Likes