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

OpenersNotesSection(Spacer1)Details

In the case of (RefLink[AssociationMap, paclet:ref/AssociationMap])[f,assoc], later instances of repeated keys replace earlier ones.

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

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create an association by mapping a function over a list of keys:

AssociationMap[f,{a,b,c,d}]

Create an "inverted index" by swapping keys and values:

AssociationMap[Reverse,<|a->1,b->2,c->3,d->4|>]

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

AssociationMap[f] @ {a,b,c,d}

OpenersExampleSection2(Spacer1)Possible Issues  (1)

(RefLink[AssociationMap, paclet:ref/AssociationMap])[f,assoc] can return invalid associations if f does not return a rule:

AssociationMap[Length,<|a->1,b->2|>]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Map, paclet:ref/Map])  ▪  (RefLink[Association, paclet:ref/Association])  ▪  (RefLink[KeyMap, paclet:ref/KeyMap])  ▪  (RefLink[Keys, paclet:ref/Keys])  ▪  (RefLink[Values, paclet:ref/Values])  ▪  (RefLink[AssociationThread, paclet:ref/AssociationThread])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Functional Programming, paclet:guide/FunctionalProgramming])}, {▪(RefLinkPlain[Computation with Structured Datasets, paclet:guide/ComputationWithStructuredDatasets])}, {▪(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])}})}})