FAQ: Data Cleaning with Pandas - Diagnose the Data

This community-built FAQ covers the “Diagnose the Data” exercise from the lesson “Data Cleaning with Pandas”.

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

Practical Data Cleaning

FAQs on the exercise Diagnose the 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!

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

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

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!

import codecademylib3_seaborn
import pandas as pd

df1 = pd.read_csv(“df1.csv”)
df2 = pd.read_csv(“df2.csv”)

df1.rename(index = str, columns={
“Grocery Item”: “grocery_item”,
“Cake Recipe”: “cake_recipe”,
“Pancake Recipe”: “pancake_recipe”,
“Cookie Recipe”: “cookie_recipe”
})
print(df1.head())
print(df1.columns)

When I run this code the columns are not re-named. Why not? What am I doing incorrectly. I am attempting to rename the columns so I can use the .value_counts() function more easily.

I have some problems when using the package “codecademylib3_seaborn”, anyone could help me?
First I imported the package and got error:
import codecademylib3_seaborn
ModuleNotFoundError: No module named 'codecademylib3_seaborn’
Then I install the package, also encount the following error:
! pip install codecademylib3_seaborn
**ERROR: Could not find a version that satisfies the requirement codecademylib3_seaborn (from versions: none) **
ERROR: No matching distribution found for codecademylib3_seaborn

Does anyone know how I can use this package?
Any help would be appreciated.

If you are running it offline on your own system, try using seaborn instead.

  • .value_counts() — display the distinct values for a column

Can someone post an example on how to use this with the given code?

It won’t work as it’s an Library created by Codecademy for Codecademy. If you trying to install

Seaborn Library

  • Then open your Command Prompt by typing cmd in Run Dialogue Box or Simply Search for it.
  • Then Type pip install seaborn

OR

You can read this Article created by Codecademy which thoroughly explains everything.

I was also stuck but @el_cocodrilo helped me.
Here’s the Correct Syntax

df1.column_name.value_counts()

It will Return all the Unique Elements and also there number of appearance.

As you can see here it returned Recipes and Their Number of Appearances in the Right Side

1 Like