How it works...
In our dataset, any missing values were represented as empty strings, so by default the CSV.read command reads in those values as missing.
As we saw in an earlier recipe, the dropmissing function (from the DataFrames.jl package) removes rows containing missing values from a DataFrame object.
The following functions are most useful when working with missing data:
-
ismissing: Checks if a value passed to it is missing.
-
coalesce: Takes a sequence of arguments and returns the first non-missing item. It is useful for the replacement of missing values. For example, coalesce.([missing,2,missing,5],0) creates a vector, replacing all missing values in with zero and in the result you get as [0, 2, 0, 5].
-
completecases: Takes DataFrame ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access