ColumnTypes
ColumnTypes[tab]
gives the element types of the columns of the Tabular object tab.
ColumnTypes[tab,tsel]
gives the element types of the columns selected by tsel.
Details
- ColumnTypes is typically used to obtain type information either to convert the type or decide what operations can be done. For instance, you cannot do date operations on strings.
- For a Tabular object tab with named columns, ColumnTypes[tab,…] returns a association of pairs coltype.
- For a Tabular object tab with unnamed columns, ColumnTypes[tab,…] returns a list of types.
- The column type selector tsel can have one of these forms:
-
tpatt type pattern tclass named class of types - Possible type patterns tpatt include cases like "Integer*" or "Quantity"::["Real64",_].
- Possible type classes tclass include:
-
"Numbers" number types "MachineNumbers" machine-sized number types "Reals" real-valued types, including integers "MachineReals" machine-sized real-valued types, including integers "Integers" integer types "MachineIntegers" machine-sized integer types "FloatingPoint" numbers with floating-point representation "MachineFloatingPoint" machine-sized real and complex numbers "FloatingPointReals" real numbers with floating-point representation "MachineFloatingPointReals" machine-sized real numbers "FloatingPointComplexes" complex numbers with floating-point representation "Lists" each element is a list
Examples
open allclose allBasic Examples (3)
Scope (15)
Numeric Types (1)
Take a collection of integers or missing values:
By default, integers will be interpreted using the "Integer64" type in this machine:
Construct three columns with the same data but casting to different types of integers:
Boolean Type (1)
String Type (1)
Quantity Types (2)
Take a collection of Quantity durations and missing values:
The values are stored using "Real64" magnitudes and a common unit of "Seconds":
For small enough Tabular objects, the original input data is cached by default and Normal recovers it:
Specify the magnitude type and unit to use:
The original input was not cached:
Quantities of different dimensions can be stored using the "InertExpression" type:
Trying to impose a specific "Quantity" type will result in missing values:
Date & Time Types (3)
Categorical Type (2)
Categorical Ordered Type (1)
Lists & Tuples (2)
Take a collection of integer tuples:
Specify the type of the elements of the tuples:
Take a collection of tuples of objects of various types:
Create a Tabular object with automatic type detection:
General Expressions (1)
Creating a Tabular object assigns type "Expression" to general Wolfram Language expressions:
Applications (1)
Text
Wolfram Research (2025), ColumnTypes, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnTypes.html.
CMS
Wolfram Language. 2025. "ColumnTypes." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ColumnTypes.html.
APA
Wolfram Language. (2025). ColumnTypes. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColumnTypes.html