This will give the desired result:
result =
dataset[
{All, Position[#b, b_ /; b > 8]&} /*
(Query[{"a", "b"}, #[[2, All, 1]]][#[[1]]]&)
]
... although the Dataset
visualizer is not very good at rendering lists within associations. It will do slightly better if we rewrap the result:
result // Dataset
As Alan notes in his response, Dataset
works more naturally with lists of associations than associations of lists.
Edit For Updated Question
The result shown here is structurally the same as the input. However because there are only two values per key, the Dataset
visualizer does not show it in the same format. Consider:
<|"a" -> Range[2]|> // Dataset
<|"a" -> Range[4]|> // Dataset
<|"a" -> Range[5]|> // Dataset
The visualizer is using a heuristic with a cutoff of four values.
If the visualization is more important that the result structure, we can force the desired appearance like this:
result // Query[All, List]
Caveat: Dataset visualization heuristics change from release to release. The screenshots in this response are current as of Mathematica 11.2.
|"a"->{4,5}|
? Sorry, I cannot see where it comes from... $\endgroup$