I am trying to find the minimum values for all elements in a list of associations, below is an example
x = {<|"a"-> 4, "b"->9, "c"->15|>, <|"a"->21, "b"->11, "c"->1|>, <|"a"->12, "b"->3, "c"->21|>}
Required output for Min {<|"a"-> 2, "b"->3, "c"->1|>}
Required output for Max {<|"a"-> 21, "b"->11, "c"->15|>}
My attempt
for Max: MaximalBy[Values]@x
Result: {<|"a" -> 21, "b" -> 11, "c" -> 1|>}
for Min: MinimalBy[Values]@x
Result: {<|"a" -> 4, "b" -> 9, "c" -> 15|>}
Is there an elegant way to achieve this result?
a
getting the value2
? That value does not appear fora
in any of the associations. Similarly, why is the value ofc
not equal to21
in the maximal result? $\endgroup$ – Shredderroy Dec 7 '18 at 6:30