For a given keyless dataset, I can query to return the rows whose columns contain a specific value. For example:
ds = Dataset[{{"a", "b"}, {"c", "d"}, {"e", "f"}, {"g", "h"}}]
Query[Select[#[[2]] == "f" &]]@ds
returns the dataset {e,f}
.
But, in this simple example, I would like to test:
Query[#[[2]]=="f"||#[[2]]="g"&]]@ds
How can I perform this operation without writing out every value of interest. For example, I want check if #[[2]]
contains any value from the list"check":
check={"f","g"}
ds[GroupBy[#[[2]]&][check]
changes the dataset structure. I just want to remove rows from the original dataset.
Query[Select[MemberQ[check, #[[2]]] &]]@ds
, for example. $\endgroup$