TabularColumn[{v1,v2,…}]
给出一个元素值为 vi 的向量,并自动确定有效的元素类型.
TabularColumn[{…},etype]
使用元素类型 etype.
TabularColumn[{…},etype,method]
使用 method 将元素转换为 etype.
TabularColumn
TabularColumn[{v1,v2,…}]
给出一个元素值为 vi 的向量,并自动确定有效的元素类型.
TabularColumn[{…},etype]
使用元素类型 etype.
TabularColumn[{…},etype,method]
使用 method 将元素转换为 etype.
更多信息
- TabularColumn 通常用于表示 Tabular 对象中的列,并且可以有效地表示不同类型的数据.
- Typed 支持的数字元素的特定类型包括:
-
"Integer8" 有符号 8 位整数,范围从
到 127"UnsignedInteger8" 整数,范围从 0 到 255 "Integer16" 有符号 16 位整数,范围从
到 
"UnsignedInteger16" 整数,范围从 0 到 65535 "Integer32" 有符号 32 位整数,范围从
到 
"UnsignedInteger32" 整数,范围从 0 到 
"Integer64" 有符号 64 位整数,范围从
到 
"UnsignedInteger64" 整数,范围从 0 到 
"Real32" 单精度实数(32 位) "Real64" 双精度实数(64 位) "ComplexReal32" 单精度复数 "ComplexReal64" 双精度复数 - 其他可能的元素类型包括:
-
"MachineInteger" 机器大小的整数 "MachineReal" 机器大小的实数 "Around"::[…] 带有不确定性的数字 "Boolean" 布尔值(True 或 False) "ByteArray"::[…] 表示二进制数据的 ByteArray 元素 "Date"::[…] 任意粒度的日历日期(日、月、 μ 秒等) "Entity"::[…] 给定域的实体 "GeoPosition"::[…] 以任何基准面和任何地理投影形式给出的地理位置 "Grouped" 由 group 编码 "InertExpression" 在使用之前不会被求值的通用表达式 "ListVector"::[type] 给定 type 的元素列表 "ListVector"::[type,n] 给定 type、长度为 n 的元素列表 "ListTuple"::[type1,type2,…] 类型为 type1, type2, … 的元素列表 "Nominal" 无序的 Nominal 类别 "Null" Missing 表达式 "Ordinal" 有序的 Ordinal 类别 "Quantity"::[type,unit] 量值 type 的大小和常用 unit "String" 字符串 "Time"::[…] 一天中的时间,例如 TimeObject - TabularColumn 对象具有布尔有效性位图. 任何未设置位图的元素都被视为缺失或具有异常值.
- 在 TabularColumn[…,etype,method] 中,method 参数是一个关联,可能的键包括:
-
"AddCategories" False 是否自动对数据进行分类 "ConversionMethod" Automatic 数值数据的转换方法 "MaxCategories" Infinity 允许的最大类别数量 "MaxMissingCases" 1 支持的最大缺失案例数 "MissingValuePattern" _Missing 缺失值的匹配模式 "Validity" All 数据的有效性位向量或 All - 数值转换方法的可能值包括:
-
Automatic 自动转换方法 "Check" 检查值是否与 type 兼容 "Coerce" 强制转换为 type "Round" 将实数四舍五入为整数 "ClipAndCheck" 将值限制在指定的范围内,并检查是否与 type 兼容 "ClipAndCoerce" 将值限制在指定的范围内,并强制转换为 type "ClipAndRound" 将值限制在指定的范围内,并将实数四舍五入为整数 - TabularColumn 转换包括:
-
Normal[TabularColumn[…]] 转换为普通的 List 向量 TabularColumn[TabularColumn[…],totype] 转换表格列,其中元素类型为 totype TabularColumn[TabularColumn[…],"Categorical"] 用无序类别表示数据 - TabularColumn[...][prop] 给出 TabularColumn 对象的属性 prop. 可以给出以下属性:
-
"ElementType" 元素类型 "Validity" 有效性位图 "MissingCount" 缺失值或异常值的数量 "MissingProxy" 用于存储缺失项的类型相关默认值 » "MissingPositions" 缺失项的位置 "Categories" 类别列表(如果存在)
范例
打开所有单元 关闭所有单元基本范例 (3)
整数的 TabularColumn 对象:
TabularColumn[{3, 2, -1, 0, 5}]%["ElementType"]将字符串存储在 TabularColumn 对象中:
TabularColumn[{"earth", "fire", "air", "water"}]Normal[%]使用 16 位整数存储数值列表,如果需要则对其进行四舍五入:
TabularColumn[{5, 7.8, -13, 11 / 3}, "Integer16", <|"ConversionMethod" -> "Round"|>]Normal[%]范围 (20)
输入数据 (5)
从整数列表构造一个 TabularColumn 对象:
TabularColumn[{4, 2, 10, 6}]从 NumericArray 对象构造 TabularColumn 对象,保留数值类型:
NumericArray[{4, 2, 10, 6}]TabularColumn[%]从 ByteArray 对象构造 TabularColumn 对象:
ByteArray[{1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1}]TabularColumn[%]ByteArray["AQIDBAUGBwg="]TabularColumn[%]从 QuantityArray 向量构造 TabularColumn 对象,保留数量单位:
QuantityArray[{4, 2, 10, 6}, "Kilograms"]TabularColumn[%]从 SparseArray 向量构造 TabularColumn 对象:
SparseArray[{1 -> 4, 10 -> 2, 100 -> 10, 1000 -> 6}]TabularColumn[%]元素类型 (3)
TabularColumn[data] 自动选择用于存储数据的元素类型:
TabularColumn[{1, 2, 3, 4}]TabularColumn[{1., 2, 3., 4}]TabularColumn[{"a", "b", "c", "d"}]TabularColumn[{Yesterday, Today, Tomorrow}]TabularColumn[{Red, Green, Blue}]TabularColumn[{1, 2, 3, 4}, "Integer16"]TabularColumn[{1, 2, 3, 4}, "UnsignedInteger8"]TabularColumn[{1, 2, 3, 4}, "Real32"]TabularColumn 对象可以为空,但它们仍然具有确定的类型:
TabularColumn[{}]TabularColumn[{}, "String"]TabularColumn[{}, "Real64"]缺失数据 (5)
TabularColumn 本地存储 Missing[…] 对象,而不影响类型检测:
TabularColumn[{1, 2, 3, Missing[], 5, Missing[]}]%["ElementType"]%%//Normal默认情况下,多个 Missing[…] 项被转换为 Missing["NotAvailable"]:
TabularColumn[{Missing["NotApplicable"], 2.8, 3.5, Missing[], 5.1, Missing["NotAvailable"]}]Normal[%]扩展所支持的不同 Missing[…] 值的数量:
TabularColumn[{Missing["NotApplicable"], 2.8, 3.5, Missing[], 5.1, Missing["NotAvailable"]}, Automatic, <|"MaxMissingCases" -> 3|>]%//Normal包括作为例外的其他类型的值,而不仅仅是 Missing[…]:
TabularColumn[{2.8, Indeterminate, 3.5, Missing[], 5.1}, Automatic, <|"MissingValuePattern" -> (_Missing | Indeterminate), "MaxMissingCases" -> 2|>]%//Normal使用 "MaxMissingCases"0 将所有缺失元素转换为 Missing["NotAvailable"]:
col1 = TabularColumn[{2.8, Indeterminate, 3.5}, <|"MissingValuePattern" -> Indeterminate|>];
{col1["MissingPositions"], Normal[col1]}col2 = TabularColumn[{2.8, Indeterminate, 3.5}, <|"MissingValuePattern" -> Indeterminate, "MaxMissingCases" -> 0|>];
{col2["MissingPositions"], Normal[col2]}取一个具有 Missing[…] 值的 TabularColumn 对象:
col = TabularColumn[{1, 2, 3, Missing[], 5, Missing[]}]col["MissingCount"]col["Validity"]%//Normalcol["MissingPositions"]col["MissingProxy"]类型转换 (3)
将整数的 TabularColumn 对象转换为实数:
TabularColumn[{4, 19, 0, -30, 22}]TabularColumn[%, "Real64"]%//Normal将整数的 TabularColumn 对象转换为 "String" 类型:
TabularColumn[{4, 19, 0, -30, 22}]TabularColumn[%, "String"]%//Normal//InputForm将实数的 TabularColumn 对象转换为 "String" 类型:
TabularColumn[{4.45, 19.23, -30.12, 22.7}]TabularColumn[%, "String"]%//Normal//InputFormTabularColumn 对象的属性 (2)
tcol = TabularColumn[{1, 2., 3., 4}];prop = {"ElementType", "Validity", "MissingCount", "MissingProxy", "MissingPositions", "Categories"};TableForm[Map[tcol[#]&, prop], TableHeadings -> {prop}]tcol = TabularColumn[{1, 0, 3, Missing[]}, "Integer16"]tcol["MissingProxy"]{tcol, tcol["RawData"]}//NormalTabularColumn[{1, 2., 3., 4}, "Real64"]["MissingProxy"]TabularColumn[{"a", "b", "c", "d"}]["MissingProxy"]//FullFormTabularColumn[{Yesterday, Today, Tomorrow}]["MissingProxy"]TabularColumn[{Red, Green, Blue}]["MissingProxy"]//FullForm表格构造 (2)
从一组长度相同的 TabularColumn 向量构造一个 Tabular 对象:
tcols = {TabularColumn[{1, 2, 3}], TabularColumn[{True, False, False}], TabularColumn[{"cat", "dog", "fox"}]}ToTabular[tcols, "Columns"]在 Tabular 对象中插入带类型的列:
tab = Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"a", "b"}]tcol = TabularColumn[{"cat", "dog", "fox"}, "String"]InsertColumns[tab, "c" -> tcol]ColumnTypes[%]应用 (3)
获取一个长字符串并将其存储在 TabularColumn 对象中:
words = RandomWord[10 ^ 5];tcol = TabularColumn[words]ByteCount /@ {words, tcol}Normal[tcol] === words将 TabularColumn 用作具有离散粒度日期的高效容器:
data = RandomDate[2000, DateGranularity -> "Day"];data[[1]]tcol = TabularColumn[data]ByteCount /@ {data, tcol}Normal[tcol] === data用 TabularColumn 处理数值计算中的 Missing 值:
data = {1.21, 3.4, 2.15, Missing[], 1.55};
Mean[data]Mean[TabularColumn[data]]属性和关系 (5)
tcol = TabularColumn[Alphabet[]]Length[tcol]Dimensions[tcol]检查它是否满足 VectorQ:
VectorQ[tcol]使用 Normal 将 TabularColumn 对象转换为元素列表:
tcol = TabularColumn[RandomInteger[10, 5]]Normal[tcol]从 TabularColumn 对象中提取元素:
alphabet = TabularColumn[Alphabet[]]alphabet[[3]]alphabet[[-3]]alphabet[[3 ;; 5]]%//Normalalphabet[[{23, 15, 12, 6, 18, 1, 13}]]//NormalTabularColumn 对象可以为空,此时默认元素类型为 "Null":
TabularColumn[{}]使用 TabularColumnQ 验证 TabularColumn 对象:
TabularColumn[{1, 2, 3, 4}]%//TabularColumnQ可能存在的问题 (1)
具有 "Instant" 粒度的日期默认以毫秒精度存储在 TabularColumn 中:
dates = RandomDate[5]TabularColumn[dates]MinMax[% - dates]使用明确的 "Microsecond" 或 "Nanosecond" 粒度来提高精度:
TabularColumn[dates, "Date"["Integer64", "Nanosecond"]]MinMax[% - dates]相关指南
-
▪
- 表格对象
文本
Wolfram Research (2025),TabularColumn,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TabularColumn.html (更新于 2026 年).
CMS
Wolfram 语言. 2025. "TabularColumn." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2026. https://reference.wolfram.com/language/ref/TabularColumn.html.
APA
Wolfram 语言. (2025). TabularColumn. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/TabularColumn.html 年
BibTeX
@misc{reference.wolfram_2026_tabularcolumn, author="Wolfram Research", title="{TabularColumn}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/TabularColumn.html}", note=[Accessed: 14-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_tabularcolumn, organization={Wolfram Research}, title={TabularColumn}, year={2026}, url={https://reference.wolfram.com/language/ref/TabularColumn.html}, note=[Accessed: 14-November-2026]}