generates a list of associations in which each association has the union of the keys of the associ, padding by inserting values of Missing[] if necessary.


uses f[key] as the value associated with a missing key.


  • KeyUnion returns a list of associations in which all the associations have keys ordered in the same way.
  • If f is an association containing all the keys to be returned by KeyUnion, then the order of keys in f will determine the order of keys in the associations returned.
  • In other cases, the keys will appear in order of their first occurrence in the sequence of associ.
  • KeyUnion can be used not only on Association objects, but also on lists of rules.


Basic Examples  (4)

Make a list of associations with the same keys:

Reorder the keys of all associations:

Use a function to provide missing values:

The missing function can be an association:

Introduced in 2014