Association 
Association[key1val1,key2val2,…] or key1val1,key2val2,…
represents an association between keys and values.
Details

- The value associated with a given key can be extracted using assoc[key].
- An Association acts like a symbolically indexed list. The value associated with a given key can be extracted by using the part specification Key[key]. If key is a string, Key can be omitted.
- If key is not present in assoc, assoc[key] yields Missing["KeyAbsent",key].
- Typical list operations (such as Map, Select, and Sort) apply to the values in an association, leaving the keys unchanged.
- Association[{key1->val1,…}] gives <key1->val1,… >.
- If there are multiple elements with the same key, all but the last of these elements are dropped. Merge yields instead a list of values for repeated keys.
- Association can be input using the characters \[LeftAssociation] and \[RightAssociation].
- Normal converts an Association to a list of rules.
- KeyValuePattern can be used to represent a pattern for associations that include particular elements.
Examples
open allclose allBasic Examples (8)
An association in which key a is associated with value x, key b with value y, etc.:
Extract the value associated with key b:
Convert a list of rules to an association:
Convert an association to a list of rules:
Keys are "transparent" for many operations:
Position gives keys in an association:
Delayed rules can be used to construct associations whose values are stored unevaluated:
The value in the association is evaluated when it is extracted:
Values in associations can be extracted like parts:
If the key in an association is a string, no explicit Key is needed to extract it as a part:
Numerical part specifications work structurally on associations:
Lookups in associations interoperate with parts in lists and other expressions:
The explicit Key can be omitted when the keys are strings:
Keys extracts the list of keys:
Scope (11)
Properties & Relations (5)
Possible Issues (2)
See Also
List Dataset Normal AssociationQ Lookup KeyExistsQ Keys Values KeyValuePattern SparseArray CompoundElement