Keys
Examples
open all close allBasic Examples (4)
Get the keys in an association:
Keys[<|a -> 1, b -> 2, c -> 3|>]Get keys from a list of rules:
Keys[{a -> 1, b -> 2, c -> 3}]Keys automatically threads over lists:
Keys[{<|a -> 1, b -> 2|>, {w -> 3, {}}}]Wrap keys with Hold to prevent evaluation:
Keys[<|a -> 2, Nothing -> 2|>, Hold]Properties & Relations (5)
Keys are listed in the order of their appearance:
Keys[{c -> z, b -> y, a -> x}]Keys automatically threads over lists, but not associations:
Keys[{<|a -> x, b -> y|>, <|a -> <|1 -> i, 2 -> j|>, b -> y|>}]Keys returns time stamps for a TimeSeries input:
ts = TemporalData[TimeSeries, {{{0.41789185146985464, -0.18600917369095216, 0.7488490054332795,
0.2258849451488465, 0.574322030837799}}, {{0, 4, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1,
{ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];Keys[ts]ts["Times"]Keys of a Tabular object returns row keys if key columns are specified:
Tabular[{{"cat", 2, 3}, {"dog", 5, 6}}, <|"ColumnKeys" -> {"a", "b", "c"}, "KeyColumns" -> {"a"}|>]Keys[%]Tabular[{{"cat", 2, 3}, {"dog", 5, 6}}, <|"ColumnKeys" -> {"a", "b", "c"}, "KeyColumns" -> {"a", "b"}|>]Keys[%]For a Tabular object without key columns, Keys returns None:
Keys[Tabular[{{1, 2}, {3, 4}, {5, 6}}]]Keys[Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"a", "b"}]]Related Guides
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_2026_keys, author="Wolfram Research", title="{Keys}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Keys.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_keys, organization={Wolfram Research}, title={Keys}, year={2025}, url={https://reference.wolfram.com/language/ref/Keys.html}, note=[Accessed: 12-June-2026]}