How it works...

The isnull method returns a DataFrame the same size as the calling DataFrame but with all values transformed to booleans. See the counts of the following data types to verify this:

>>> movie.isnull().get_dtype_counts()
bool 28
dtype: int64

As booleans evaluate numerically as 0/1, it is possible to sum them by column, as done in step 2. The resulting Series itself also has a sum method, which gets us the grand total of missing values in the DataFrame.

In step 4, the any DataFrame method returns a Series of booleans indicating if there exists at least one True for each column. The any method is chained again on this resulting Series of booleans to determine if any of the columns have missing values. If step 4 evaluates as True, then there is at least one missing value in the entire DataFrame.

..................Content has been hidden....................

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