Given:
titanic = ExampleData[{"Dataset", "Titanic"}]
Why does this correctly delete Missing[] elements:
titanic[GroupBy@Key@"class", DeleteMissing[#, 1] &, "age"] // Normal
but not the default level spec? Seems to violate key transparency in Associations/Datasets
.
titanic[GroupBy@Key@"class", DeleteMissing, "age"] // Normal
(* <|"1st" -> {29, 1, 2, 30, 25, 48, 63, 39, 53, 71, 47, 18, 24, 26, 80,
Missing[], 24, 50, 32,... |> *)
DeleteMissing
also works on the bare list, as would any function applied at that Dataset slot. On the other hand:
<| "key" -> {29, 1, 2, 30, 25, 48, 63, 39, 53, 71, 47, 18, 24, 26, 80,
Missing[], 24, ... |> // DeleteMissing[#, 2] &
Level 2 is the minimum needed to delete missing element?
DeleteMissing
should work. I am guessing this is just moreDataset
weirdness. Personally I am waiting for 10.0.1 before continuing to use this functionality as there is too much inconsistency at this point IMO. Good question however, which will hopefully help to get the inconsistencies resolved. $\endgroup$Select[FreeQ[_Missing]]
rather thanDeleteMissing
. It seems better behaved. For example,titanic[GroupBy@Key@"class", Select[FreeQ[_Missing]], "age"] // Normal
works as expected. $\endgroup$Dataset
yet but I'm trying. $\endgroup$