Skip to content
Felix
  • Topics
    • My List
    • Felix Guide
    • Asset Management
    • Coding and Data Analysis
      • Data Analysis and Visualization
      • Financial Data Tools
      • Python
      • SQL
    • Credit
      • Credit Analysis
      • Restructuring
    • Financial Literacy Essentials
      • Financial Data Tools
      • Financial Math
      • Foundations of Accounting
    • Industry Specific
      • Banks
      • Chemicals
      • Consumer
      • ESG
      • Insurance
      • Oil and Gas
      • Pharmaceuticals
      • Project Finance
      • Real Estate
      • Renewable Energy
      • Technology
      • Telecoms
    • Introductory Courses
    • Investment Banking
      • Accounting
      • Financial Modeling
      • M&A and Divestitures
      • Private Debt
      • Private Equity
      • Valuation
      • Venture Capital
    • Markets
      • Economics
      • Equity Markets and Derivatives
      • Fixed Income and Derivatives
      • Introduction to Markets
      • Options and Structured Products
      • Other Capital Markets
      • Securities Services
    • Microsoft Office
      • Excel
      • PowerPoint
      • Word & Outlook
    • Professional Skills
      • Career Development
      • Expert Interviews
      • Interview Skills
    • Risk Management
    • Transaction Banking
    • Felix Live
  • Pathways
    • Investment Banking
    • Asset Management
    • Equity Research
    • Sales and Trading
    • Commercial Banking
    • Engineering
    • Operations
    • Private Equity
    • Credit Analysis
    • Restructuring
    • Venture Capital
    • CFA Institute
  • Certified Courses
  • Ask An Instructor
  • Support
  • Log in
  • Topics
    • My List
    • Felix Guide
    • Asset Management
    • Coding and Data Analysis
      • Data Analysis and Visualization
      • Financial Data Tools
      • Python
      • SQL
    • Credit
      • Credit Analysis
      • Restructuring
    • Financial Literacy Essentials
      • Financial Data Tools
      • Financial Math
      • Foundations of Accounting
    • Industry Specific
      • Banks
      • Chemicals
      • Consumer
      • ESG
      • Insurance
      • Oil and Gas
      • Pharmaceuticals
      • Project Finance
      • Real Estate
      • Renewable Energy
      • Technology
      • Telecoms
    • Introductory Courses
    • Investment Banking
      • Accounting
      • Financial Modeling
      • M&A and Divestitures
      • Private Debt
      • Private Equity
      • Valuation
      • Venture Capital
    • Markets
      • Economics
      • Equity Markets and Derivatives
      • Fixed Income and Derivatives
      • Introduction to Markets
      • Options and Structured Products
      • Other Capital Markets
      • Securities Services
    • Microsoft Office
      • Excel
      • PowerPoint
      • Word & Outlook
    • Professional Skills
      • Career Development
      • Expert Interviews
      • Interview Skills
    • Risk Management
    • Transaction Banking
    • Felix Live
  • Pathways
    • Investment Banking
    • Asset Management
    • Equity Research
    • Sales and Trading
    • Commercial Banking
    • Engineering
    • Operations
    • Private Equity
    • Credit Analysis
    • Restructuring
    • Venture Capital
    • CFA Institute
  • Certified Courses
Felix
  • Data
    • Company Analytics
    • My Filing Annotations
    • Market & Industry Data
    • United States
    • Relative Valuation
    • Discount Rate
    • Building Forecasts
    • Capital Structure Analysis
    • Europe
    • Relative Valuation
    • Discount Rate
    • Building Forecasts
    • Capital Structure Analysis
  • Models
  • Account
    • Edit my profile
    • My List
    • Restart Homepage Tour
    • Restart Company Analytics Tour
    • Restart Filings Tour
  • Log in
  • Ask An Instructor
    • Email Our Experts
    • Felix User Guide
    • Contact Support

Data Cleaning and Exploration in Python

Learn how to identify and correct errors in categorical variables, eliminate sparse classes, and visualize distributions. Remove unwanted observations, identify and eliminate null values in a dataset.

Unlock Your Certificate   
 
0% Complete

24 Lessons (33m)

Show lesson playlist
  • Description & Objectives

  • 1. Data Cleaning Learning Objectives

    00:30
  • 2. The Machine Learning Process

    02:02
  • 3. Matplotlib and Seaborn

    00:45
  • 4. Errors in Stock Data Dataset

    01:24
  • 5. Matplotlib and Seaborn Workout

    01:46
  • 6. Countplot

    01:21
  • 7. Countplot Workout

    01:57
  • 8. Replace and Sparse Classes

    03:01
  • 9. Replace Workout

    01:55
  • 10. Sparse Classes Workout

    02:14
  • 11. Spotting Outliers

    01:08
  • 12. Spotting Outliers Workout 1

    01:31
  • 13. Spotting Outliers Workout 2

    01:23
  • 14. Spotting Outliers Workout 3

    01:15
  • 15. Spotting Outliers Workout 4

    01:38
  • 16. Summary Statistics Workout

    00:47
  • 17. NaN Object

    02:10
  • 18. NaN Object Workout

    01:02
  • 19. Dropping Null Values

    00:32
  • 20. Dropping Null Values Workout

    00:45
  • 21. Box Plots

    00:52
  • 22. Box Plots Workout

    01:17
  • 23. Saving Your Data Frame

    00:52
  • 24. Data Cleaning and Exploration Review

    00:31

Next: Regression Algorithms in Python

Sparse Classes Workout

  • Notes
  • Questions
  • Transcript
  • 02:14

Practice using sparse classes in Python.

Downloads

No associated resources to download.

Glossary

Machine Learning Python Sparse Classes Sparse Function
Back to top
Financial Edge Training

© Financial Edge Training 2025

Topics
Introduction to Finance Accounting Financial Modeling Valuation M&A and Divestitures Private Equity
Venture Capital Project Finance Credit Analysis Transaction Banking Restructuring Capital Markets
Asset Management Risk Management Economics Data Science and System
Request New Content
System Account User Guide Privacy Policy Terms & Conditions Log in
Transcript

You'll notice that there are not very many observations in the materials, telecommunication services, utilities, and real estate sectors. So let's go ahead and add materials to the industrial sector and then combine telecom, utilities, and real estate into one other bucket. Finally, when you're finished with that display a countplot with your results to verify that everything worked correctly, we're going to address the issue of sparse classes. And sparse classes are classes in a categorical feature like we have in sector. In this example where there are very few observations, machine learning algorithms require as many observations as possible in order to make accurate predictions, because it has to learn patterns from your data. So a sparse class that only has a few observations is not useful for your machine learning algorithm and might actually be detrimental. We can get some useful information out of these classes by combining them together or dumping them into another bucket that's similar. So in this case, we're going to add materials to the industrial sector, and then we're going to combine telecom, utilities, and real estate into one other bucket.

The process here is exactly the same as the last exercise. So stock data are data frame sector, our feature, and then the replace function. Our first argument is the class that we want to replace. The second argument is the new value that we wanna replace it with, and then we're using the inplace argument here. We're replacing telecommunication services, utilities, and real estate. So those are all together in the first argument inside a list. Our second argument is what we want to replace it with, which is the other class.

And when I execute that cell, it's going to make those changes in our stock data dataframe, and I can see that when I execute this last cell with our countplot function. So you can see here that these different sparse classes have been aggregated into industrials and the other buckets. So now we have fewer classes with more observations. So that's gonna be more useful for our machine learning algorithm to learn from.

Content Requests and Questions

You are trying to access premium learning content.

Discover our full catalogue and purchase a course Access all courses with our premium plans or log in to your account
Help

You need an account to contact support.

Create a free account or log in to an existing one

Sorry, you don't have access to that yet!

You are trying to access premium learning content.

Discover our full catalogue and purchase a course Access all courses with our premium plans or log in to your account

You have reached the limit of annotations (10) under our premium subscription. Upgrade to unlock unlimited annotations.

Find out more about our premium plan

You are trying to access content that requires a free account. Sign up or login in seconds!

Create a free account or log in to an existing one

You are trying to access content that requires a premium plan.

Find out more about our premium plan or log in to your account

Only US listed companies are available under our Free and Boost plans. Upgrade to Pro to access over 7,000 global companies across the US, UK, Canada, France, Italy, Germany, Hong Kong and more.

Find out more about our premium plan or log in to your account

A pro account is required for the Excel Add In

Find out more about our premium plan

Congratulations on completing

This field is hidden when viewing the form
Name(Required)
This field is hidden when viewing the form
Rate this course out of 5, where 5 is excellent and 1 is terrible.
Were the stated learning objectives met?(Required)
Were the stated prerequisite requirements appropriate and sufficient?(Required)
Were the program materials, including the qualified assessment, relevant and did they contribute to the achievement of the learning objectives?(Required)
Was the time allotted to the learning activity appropriate?(Required)
Are you happy for us to use your feedback and details in future marketing?(Required)

Thank you for already submitting feedback for this course.

CPE

What is CPE?

CPE stands for Continuing Professional Education, by completing learning activities you earn CPE credits to retain your professional credentials. CPE is required for Certified Public Accountants (CPAs). Financial Edge Training is registered with the National Association of State Boards of Accountancy (NASBA) as a sponsor of continuing professional education on the National Registry of CPE Sponsors.

What are CPE credits?

For self study programs, 1 CPE credit is awarded for every 50 minutes of elearning content, this includes videos, workouts, tryouts, and exams.

CPE Exams

You must complete the CPE exam within 1 year of accessing a related playlist or course to earn CPE credits. To see how long you have left to complete a CPE exam, hover over the locked CPE credits button.

What if I'm not collecting CPE credits?

CPE exams do not count towards your FE certification. You do not need to complete the CPE exam if you are not collecting CPE credits, but you might find it useful for your own revision.


Further Help
  • Felix How to Guide walks you through the key functions and tools of the learning platform.
  • Playlists & Tryouts: Playlists are a collection of videos that teach you a specific skill and are tested with a tryout at the end. A tryout is a quiz that tests your knowledge and understanding of what you have just learned.
  • Exam: If you are collecting CPE points you must pass the relevant CPE exam within 1 year to receive credits.
  • Glossary: A glossary can be found below each video and provides definitions and explanations for terms and concepts. They are organized alphabetically to make it easy for you to find the term you need.
  • Search function: Use the Felix search function on the homepage to find content related to what you want to learn. Find related video content, lessons, and questions people have asked on the topic.
  • Closed Captions & Transcript: Closed captions and transcripts are available on videos. The video transcript can be found next to the closed captions in the video player. The transcript feature allows you to read the transcript of the video and search for key terms within the transcript.
  • Questions: If you have questions about the course content, you will find a section called Ask a Question underneath each video where you can submit questions to our expert instructor team.