Cleaning Data in Python

This course will equip you with all the skills you need to clean your data in Python.

Start Course for Free
4 Hours17 Videos58 Exercises104,449 Learners
4800 XP

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved by learners at thousands of companies

Course Description

A vital component of data science involves acquiring raw data and getting it into a form ready for analysis. It is commonly said that data scientists spend 80% of their time cleaning and manipulating data, and only 20% of their time actually analyzing it. This course will equip you with all the skills you need to clean your data in Python, from learning how to diagnose problems in your data, to dealing with missing values and outliers. At the end of the course, you'll apply all of the techniques you've learned to a case study to clean a real-world Gapminder dataset.

  1. 1

    Exploring your data


    Say you've just gotten your hands on a brand new dataset and are itching to start exploring it. But where do you begin, and how can you be sure your dataset is clean? This chapter will introduce you to data cleaning in Python. You'll learn how to explore your data with an eye for diagnosing issues such as outliers, missing values, and duplicate rows.

    Play Chapter Now
    Diagnose data for cleaning
    50 xp
    Loading and viewing your data
    100 xp
    Further diagnosis
    100 xp
    Exploratory data analysis
    50 xp
    Calculating summary statistics
    50 xp
    Frequency counts for categorical data
    100 xp
    Visual exploratory data analysis
    50 xp
    Visualizing single variables with histograms
    100 xp
    Visualizing multiple variables with boxplots
    100 xp
    Visualizing multiple variables with scatter plots
    100 xp
  2. 2

    Tidying data for analysis

    Learn about the principles of tidy data, and more importantly, why you should care about them and how they make data analysis more efficient. You'll gain first-hand experience with reshaping and tidying data using techniques such as pivoting and melting.

    Play Chapter Now
  3. 3

    Combining data for analysis

    The ability to transform and combine your data is a crucial skill in data science, because your data may not always come in one monolithic file or table for you to load. A large dataset may be broken into separate datasets to facilitate easier storage and sharing. But it's important to be able to run your analysis on a single dataset. You'll need to learn how to combine datasets or clean each dataset separately so you can combine them later for analysis.

    Play Chapter Now
  4. 4

    Cleaning data for analysis

    Dive into some of the grittier aspects of data cleaning. Learn about string manipulation and pattern matching to deal with unstructured data, and then explore techniques to deal with missing or duplicate data. You'll also learn the valuable skill of programmatically checking your data for consistency, which will give you confidence that your code is running correctly and that the results of your analysis are reliable.

    Play Chapter Now
  5. 5

    Case study

    In this final chapter, you'll apply all of the data cleaning techniques you've learned in this course toward tidying a real-world, messy dataset obtained from the Gapminder Foundation. Once you're done, not only will you have a clean and tidy dataset, you'll also be ready to start working on your own data science projects using Python.

    Play Chapter Now


Air qualityDOB job application filingsEbolaGapminderTuberculosisTipsNYC Uber data


Hugo Bowne-AndersonYashas Roy


Intermediate Python
Daniel Chen Headshot

Daniel Chen

Data Science Consultant at Lander Analytics

Daniel is a Software Carpentry instructor and a doctoral student in Genetics, Bioinformatics, and Computational Biology at Virginia Tech, where he works in the Social and Decision Analytics Laboratory under the Biocomplexity Institute. He received his MPH at the Mailman School of Public Health in Epidemiology and is interested in integrating hospital data in order to perform predictive health analytics and build clinical support tools for clinicians. An advocate of open science, he aspires to bridge data science with epidemiology and health care.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA