October 2017
Intermediate to advanced
532 pages
16h 10m
English
Instead of summing up the booleans in step 3 to find the total number of missing values, we can take the mean of the Series to get the percentage of values that are missing:
>>> actor_1_fb_likes.isnull().mean()0.0014
As was mentioned at the beginning of the recipe, it is possible to use parentheses instead of the backslash for multi-line code. Step 4 may be rewritten this way:
>>> (actor_1_fb_likes.fillna(0) .astype(int) .head())
Not all programmers like the use of method chaining, as there are some downsides. One such downside is that debugging becomes difficult. None of the intermediate objects produced during the chain are stored in a variable, so if there is an unexpected result, it will be difficult to trace the exact ...
Read now
Unlock full access