Show only rows with missing in one column

I can’t quite figure out how to subset a dataframe to only show rows with missing values in a certain column.

Take this example

df1 = DataFrame(B=[1,2,3],C=["x",missing,missing])

What is the syntax to get only the missing rows from df1?

Base DateaFrames Approach:

df1[ismissing.(df1[:C]), :]

DataFramesMeta approach

@where(df1, ismissing.(:C))
2 Likes

Thanks! I expected this to be easy to find, but going through google and several of the docs, I couldn’t find this information. Did I miss this in the docs somewhere?

I think you are correct. The docs for DataFrames seem to be missing the fact that df[BitArray, :] produces a subset where the rows are only those for which the Bitarray takes a value of true.

You can post an issue if you want, otherwise I will and we can add a line in the docs.

I’m not familiar with the process for updating those docs, so please do so. Thanks.

Great! For next time, for all julia packages, the documentation is included in the git repo of the package itself, so getting an update to the docs is as simple as posting an issue there.