O'Reilly logo

Mastering Exploratory Analysis with pandas by Harish Garg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling missing values in pandas

In this section, we will explore how we can use various pandas techniques to handle the missing data in our datasets. We will learn how to find out how much data is missing, and from which columns. We'll see how to drop rows or columns where all or a lot of records are missing data. We'll also learn how, instead of dropping data, we can also fill in the missing records with zeros or the mean of the remaining values.

We will start by importing the pandas module into our Jupyter notebook:

import pandas as pd

We will then read in our CSV dataset:

data = pd.read_csv('data-titanic.csv')data.head()

This dataset ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required