({{, (RefLink[KeyMap, paclet:ref/KeyMap])[f,\[LeftAssociation](Subscript[key, 1])->(Subscript[val, 1]),(Subscript[key, 2])->(Subscript[val, 2]),…\[RightAssociation]] 
maps f over the keys in an association, giving \[LeftAssociation]f[(Subscript[key, 1])]->(Subscript[val, 1]),f[(Subscript[key, 2])]->(Subscript[val, 2]),…\[RightAssociation].}, {, (RefLink[KeyMap, paclet:ref/KeyMap])[f]
represents an operator form of (RefLink[KeyMap, paclet:ref/KeyMap]) that can be applied to an expression.}})

OpenersNotesSection(Spacer1)Details

If any of the f[(Subscript[key, i])] are identical, the values associated with later instances replace those associated with earlier ones.

(RefLink[KeyMap, paclet:ref/KeyMap])[f][expr] is equivalent to (RefLink[KeyMap, paclet:ref/KeyMap])[f,expr].

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Map a function over the keys of an association:

KeyMap[f, <|a->1,b->2,c->3|>]

Use the operator form of (RefLink[KeyMap, paclet:ref/KeyMap]):

KeyMap[f][ <|a->1,b->2,c->3|>]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[AssociationMap, paclet:ref/AssociationMap])  ▪  (RefLink[Map, paclet:ref/Map])  ▪  (RefLink[Keys, paclet:ref/Keys])  ▪  (RefLink[KeySelect, paclet:ref/KeySelect])  ▪  (RefLink[KeyValueMap, paclet:ref/KeyValueMap])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Associations, paclet:guide/Associations])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/34-associations.html])(WebLink[: Associations, https://www.wolfram.com/language/elementary-introduction/34-associations.html])}})}})