WOLFRAM

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)Summary of the most common use cases

Get the keys in an association:

Out[1]=1

Get keys from a list of rules:

Out[1]=1

Keys automatically threads over lists:

Out[1]=1

Wrap keys with Hold to prevent evaluation:

Out[1]=1

Properties & Relations  (5)Properties of the function, and connections to other functions

Keys are listed in the order of their appearance:

Out[1]=1

Keys automatically threads over lists, but not associations:

Out[1]=1

Keys returns time stamps for a TimeSeries input:

Out[2]=2
Out[3]=3

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

Out[1]=1
Out[2]=2

For multiple key columns:

Out[3]=3
Out[4]=4

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

Out[1]=1
Out[2]=2
Wolfram Research (2014), Keys, Wolfram Language function, https://reference.wolfram.com/language/ref/Keys.html (updated 2025).
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).

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.

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

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

BibTeX

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

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

BibLaTeX

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

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