Mathematica has almost the following example in the documentation:
dataset = Dataset[{<|"a" -> 1, "b" -> "x", "c" -> 7|>, <|"a" -> 2, "b" -> "y","c" -> 9|>,
<|"a" -> "-", "b" -> "z", "c" -> "-"|>, <|"a" -> 4, "b" -> "x", "c" -> 1|>,
<|"a" -> "-", "b" -> "y", "c" -> "-"|>, <| "a" -> 6, "b" -> "z", "c" -> 8|>}]
The first and last columns are slightly changed compared to the Mathematica documentation. To select data based on a criteria related to a column the example is:
dataset[Select[#a < 5 &]]
What I need to have is – in its simple form:
dataset[Select[
NumberQ[#["a"]] || NumberQ[#["b"]] || NumberQ[#["c"]] &]]
However, in the complete form there are 300+ columns, and I want to select all the datasets – but only from a subset of columns (i.e. categories/keys) – that contain numbers. I have the categories of the columns to which Select
should apply in a list (in this case the list would be {"a","b","c"}
).
dataset[Select[Or @@ (NumberQ /@ Slot /@ {"a", "b", "c", "d"})]]
? I'm not sure I totally grasp your example; I hadn't seen Dataset used like this before, but it's cool! $\endgroup$