ComponentKeys
是 TimeSeries 和 EventSeries 的一个选项,用于指定各个分量的键.
更多信息
- ComponentKeys 通常用于为时间序列或事件序列的数据分量命名.
- ComponentKeys 的可能设置包括:
-
Automatic 从数据中自动选择分量键 » None 返回简单的时间序列或事件序列 » {com1,com2,…} 返回具有指定分量名 comi 的时间序列或事件序列 » - TimeSeries[vals,times,keys] 等价于 TimeSeries[vals,times,ComponentKeyskeys].
范例
打开所有单元 关闭所有单元基本范例 (2)
TimeSeries[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> {"a", "b"}]通过转换为 Tabular 显示数据:
Tabular[%]EventSeries[{{DateObject[{2026, 1, 3, 4, 2, 54.5329}, "Instant", "Gregorian", -6.], DateObject[{2026, 1, 18, 13, 51, 58.9335}, "Instant", "Gregorian", -6.]}, {DateObject[{2026, 2, 1, 16, 9, 14.7054}, "Instant", "Gregorian", -6.], DateObject[{2026, 2, 17, 6, 1, 9.07329}, "Instant", "Gregorian", -6.]}, {DateObject[{2026, 3, 3, 5, 37, 53.7335}, "Instant", "Gregorian", -6.], DateObject[{2026, 3, 18, 19, 23, 28.7273}, "Instant", "Gregorian", -6.]}}, {DateObject[{2026, 1}], Automatic, "Month"}, ComponentKeys -> {"FullMoon", "NewMoon"}]通过转换为 Tabular 显示数据:
Tabular[%]范围 (6)
TimeSeries[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> {"a", "b"}]通过转换为 Tabular 显示数据:
Tabular[%]TimeSeries[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> {"number"}]ColumnKeys[%]TimeSeries[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> {}]ColumnKeys[%]Automatic 的 ComponentKeys 设置会保留输入键:
Tabular[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {"K1", "K2"}]tab = Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["K1" -> Association["ElementType" -> "Real64"],
"K2" -> Association["ElementType" -> "String"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{0.1, 0.2, 0.3}, {}, None},
"ElementType" -> "Real64"]], TabularColumn[Association[
"Data" -> {{3, {0, 3, 6, 9}, "catdogfox"}, {}, None}, "ElementType" -> "String"]]}}]]]];TimeSeries[tab, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> Automatic]Tabular[%]tab = Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["K1" -> Association["ElementType" -> "Real64"],
"K2" -> Association["ElementType" -> "String"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{0.1, 0.2, 0.3}, {}, None},
"ElementType" -> "Real64"]], TabularColumn[Association[
"Data" -> {{3, {0, 3, 6, 9}, "catdogfox"}, {}, None}, "ElementType" -> "String"]]}}]]]];TimeSeries[tab, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> {"a", "b"}]Tabular[%]当组件键设置为 None 时,输出的时间序列是简单的,不包含显式的分量:
tab = Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["K1" -> Association["ElementType" -> "Real64"],
"K2" -> Association["ElementType" -> "String"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{0.1, 0.2, 0.3}, {}, None},
"ElementType" -> "Real64"]], TabularColumn[Association[
"Data" -> {{3, {0, 3, 6, 9}, "catdogfox"}, {}, None}, "ElementType" -> "String"]]}}]]]];TimeSeries[tab, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> None]Tabular[%]当没有输入键时,Automatic 设置将保留简单的分量输入:
TimeSeries[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {{Yesterday, Today, Tomorrow}}, ComponentKeys -> Automatic]Tabular[%]属性和关系 (2)
vals = {{.1, "cat"}, {.2, "dog"}, {.3, "fox"}};
times = {Yesterday, Today, Tomorrow};
keys = {"number", "animal"};TimeSeries[vals, {times}, keys]TimeSeries[vals, {times}, ComponentKeys -> keys] === %TimeSeries[{{.1, "cat"}, {.2, "dog"}, {.3, "fox"}}, {{Yesterday, Today, Tomorrow}}, {"A", "B"}, ComponentKeys -> {"a", "b"}]Tabular[%]文本
Wolfram Research (2026),ComponentKeys,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ComponentKeys.html.
CMS
Wolfram 语言. 2026. "ComponentKeys." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/ComponentKeys.html.
APA
Wolfram 语言. (2026). ComponentKeys. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ComponentKeys.html 年
BibTeX
@misc{reference.wolfram_2026_componentkeys, author="Wolfram Research", title="{ComponentKeys}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/ComponentKeys.html}", note=[Accessed: 07-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_componentkeys, organization={Wolfram Research}, title={ComponentKeys}, year={2026}, url={https://reference.wolfram.com/language/ref/ComponentKeys.html}, note=[Accessed: 07-September-2026]}