To get a count of the missing values, the isnull method must first be called to change each DataFrame value to a boolean. Let's call this method on the movie dataset:
>>> movie = pd.read_csv('data/movie.csv') >>> movie.isnull().head()
We will chain the sum method that interprets True/False booleans as 1/0. Notice that a Series is returned:
We can go one step further and take the sum of this Series and return the count of the total number of missing values in the entire DataFrame as a scalar value:
>>> movie.isnull().sum().sum() 2654
A slight deviation is to determine whether there are any missing values in the DataFrame. We use the any method here twice in succession to do this: