How to do it...

  1. 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()
  1. We will chain the sum method that interprets True/False booleans as 1/0. Notice that a Series is returned:
>>> movie.isnull().sum().head()
color 19 director_name 102 num_critic_for_reviews 49 duration 15 director_facebook_likes 102 dtype: int64
  1. 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
  1. 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:
>>> movie.isnull().any().any()
True
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.5.201