I want to a apply a function to the 2nd row and 2nd column of an association:
dt =
<|"Arizona" -> <|"1801" -> 60, "1802" -> 1530, "1803" -> 100, "1804" -> 665|>,
"Kansas" -> <|"1801" -> 1160, "1802" -> 415, "1803" -> 825, "1804" -> 230|>,
"Texas" -> <|"1801" -> 365, "1802" -> 135, "1803" -> 70, "1804" -> 1280|>,
"Vermont" -> <|"1801" -> 60, "1802" -> 485, "1803" -> "100", "1804" -> 555|>|>;
I tried:
Query[
<|#, "Kansas" -> f /@ #Kansas|> &,
<|#, "1802" -> f @ #"1802"|> &] @ dt // Dataset[#, ItemSize -> 7] &
At "Kansas" / "1802" the function was applied twice, but I want it to be applied only once. Is there an easy / elegant way to achieve this?