Dataframes: How to conditionally remove rows based on data values?

Not sure about Query but note that you can always subset easily in plain DataFrames:

df[(df.A .!= "Y") .& (df.B .!= "D"), :]

is pretty readable imho.

You might be using filter the wrong way around, cf this thread: The filter function is non-intuitive - #10 by ianfiske (although the thread is about the filter function, not the Query macro)

3 Likes