ColumnKeys
ColumnKeys[tab]
gives a list of the column keys in the Tabular object tab.
ColumnKeys[tab,spatt]
gives the column keys of tab that match the string pattern spatt.
ColumnKeys[tab,crit]
gives the column keys keyi of tab for which crit[keyi] is True.
Details
- ColumnKeys is typically used to get a list of column keys or search for specific keys.
- ColumnKeys returns column keys in the same order in which they appear in the Tabular object.
- For a Tabular object tab with anonymous columns, ColumnKeys[tab,…] returns None.
- In ColumnKeys[tab,spatt], possible string patterns include strings with wild characters, such as "col*" and StringExpression objects such as "col"~~__.
- In ColumnKeys[tab,crit], the function crit takes named variables #ColumnKey, providing the column key, and #ElementType, providing the type of the elements of the column.
Examples
open allclose allBasic Examples (3)
Scope (8)
Get the column keys of a Tabular object:
Get the column keys of a Dataset object:
Get the keys of a list of associations:
ColumnKeys gives the unsorted union of the keys of the associations:
The result is also consistent with the corresponding Tabular object:
The column keys of a Tabular object can be arbitrary expressions:
Take a Tabular object:
Use string patterns to select the columns whose key ends in "1":
Use a criterion function to select the keys of columns with integers:
Get the column keys for multilevel column names:
Key columns are included in the result of ColumnKeys:
For a Tabular object with unspecified column keys, ColumnKeys returns None:
Properties & Relations (1)
ColumnKeyExistsQ[tab,key] returns True if key is in the list ColumnKeys[tab]:
Text
Wolfram Research (2025), ColumnKeys, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnKeys.html.
CMS
Wolfram Language. 2025. "ColumnKeys." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ColumnKeys.html.
APA
Wolfram Language. (2025). ColumnKeys. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColumnKeys.html