Handling missing and NA data

Next, we will see how to handle missing data by reading a CSV file. By default, read_csv considers the following values missing and marks them as NaN:

However, you can add to this list. To do so, simply pass the list of values you want to be considered as NaNas shown in the following code:

df = pd.read_csv('IMDB.csv', encoding = "ISO-8859-1", na_values=[''])

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.