Keys

Keys[key1val1,key2val2,]

gives a list of the keys keyi in an association.

Keys[{key1val1,key2val2,}]

gives a list of the keyi in a list of rules.

Keys[expr,h]

gives a list of keys in expr, wrapping each of them with head h before evaluation.

Details

Examples

open allclose all

Basic Examples  (4)

Get the keys in an association:

Get keys from a list of rules:

Keys automatically threads over lists:

Wrap keys with Hold to prevent evaluation:

Properties & Relations  (5)

Keys are listed in the order of their appearance:

Keys automatically threads over lists, but not associations:

Keys returns time stamps for a TimeSeries input:

Keys of a Tabular object returns row keys if key columns are specified:

For multiple key columns:

For a Tabular object without key columns, Keys returns None:

Wolfram Research (2014), Keys, Wolfram Language function, https://reference.wolfram.com/language/ref/Keys.html (updated 2025).

Text

Wolfram Research (2014), Keys, Wolfram Language function, https://reference.wolfram.com/language/ref/Keys.html (updated 2025).

CMS

Wolfram Language. 2014. "Keys." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/Keys.html.

APA

Wolfram Language. (2014). Keys. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Keys.html

BibTeX

@misc{reference.wolfram_2024_keys, author="Wolfram Research", title="{Keys}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Keys.html}", note=[Accessed: 21-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_keys, organization={Wolfram Research}, title={Keys}, year={2025}, url={https://reference.wolfram.com/language/ref/Keys.html}, note=[Accessed: 21-January-2025 ]}