WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

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
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Numeric Types  
Boolean Type  
String Type  
Show More Show More
Quantity Types  
Date & Time Types  
GeoPosition Type  
Lists & Tuples  
General Expressions  
Data Forms  
Column Selectors  
Applications  
See Also
Related Guides
History
Cite this Page

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 "String", "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
    "Strings" each element is a string
  • ColumnTypes can also give the component types of TimeSeries and EventSeries objects.

Examples

open all close all

Basic Examples  (3)

Find the types that are automatically selected for this Tabular object:

Wolfram Language code: Tabular[{{1, "dog", True}, {2, "cat", False}}, {"col1", "col2", "col3"}]
Wolfram Language code: ColumnTypes[%]

Find the types of the columns of reals:

Wolfram Language code: Tabular[{{3.1, 4, False}, {2.5, -3, True}}, {"number", "symbol", "boolean"}]
Wolfram Language code: ColumnTypes[%, "Real*"]

Construct a Tabular object without keys from a numeric matrix:

Wolfram Language code: Tabular[{{1, 2.}, {3, 4.}, {5, 6.}}]

Find the list of types of each column:

Wolfram Language code: ColumnTypes[%]

Scope  (15)

Numeric Types  (1)

Take a collection of integers or missing values:

Wolfram Language code: data = ReplacePart[RandomInteger[{-100, 100}, 6], 4 -> Missing[]];
Wolfram Language code: ToTabular[<|"col" -> data|>, "Columns"]

By default, integers will be interpreted using the "Integer64" type in this machine:

Wolfram Language code: ColumnTypes[%]

Construct three columns with the same data but casting to different types of integers:

Wolfram Language code: tab = ToTabular[<|"col8" -> data, "col16" -> data, "col32" -> data|>, "Columns", <|"ElementType" -> {"col8" -> "Integer8", "col16" -> "Integer16", "col32" -> "Integer32"}|>]

Check the stored types:

Wolfram Language code: ColumnTypes[tab]

Boolean Type  (1)

Take a collection of Boolean or missing values:

Wolfram Language code: data = RandomChoice[{True, False, Missing[]}, 6]

ToTabular automatically interprets the data as a column of "Boolean" type:

Wolfram Language code: ToTabular[{"col" -> data}, "Columns"]
Wolfram Language code: ColumnTypes[%]

String Type  (1)

Take a collection of words or missing values:

Wolfram Language code: data = ReplacePart[RandomWord[6], 5 -> Missing[]]

ToTabular automatically interprets the data as a column of "String" type:

Wolfram Language code: ToTabular[<|"col" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[%]

Quantity Types  (2)

Take a collection of Quantity durations and missing values:

Wolfram Language code: data = {Quantity[3.2, "Minutes"], Quantity[90., "Seconds"], Missing[], Quantity[0., "Seconds"]}
Wolfram Language code: tab = ToTabular[<|"col" -> data|>, "Columns"]

The values are stored using "Real64" magnitudes and a common unit of "Seconds":

Wolfram Language code: ColumnTypes[%]

For small enough Tabular objects, the original input data is cached by default and Normal recovers it:

Wolfram Language code: Normal[tab]

Specify the magnitude type and unit to use:

Wolfram Language code: tab = CastColumns[tab, "col" -> "Quantity"::["Real32", "Minutes"]]
Wolfram Language code: ColumnTypes[%]

The original input was not cached:

Wolfram Language code: Normal[tab]

Quantities of different dimensions can be stored using the "InertExpression" type:

Wolfram Language code: data = {Quantity[2, "Years"], Quantity[1, "LightYears"]}
Wolfram Language code: tab = ToTabular[<|"col" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[tab]

Trying to impose a specific "Quantity" type will result in missing values:

Wolfram Language code: CastColumns[tab, "col" -> "Quantity"::["Integer64", "Years"]]
Wolfram Language code: Normal[%]

Date & Time Types  (3)

Take a collection of dates:

Wolfram Language code: data = RandomDate[6]

Create a Tabular object with automatic type detection:

Wolfram Language code: tab1 = ToTabular[<|"col" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[tab1]

Specify a type to convert to granularity "Day" when dates are extracted:

Wolfram Language code: tab2 = ToTabular[<|"col" -> data|>, "Columns", <|"ElementType" -> {"Date"::["Integer64", "Day"]}|>]
Wolfram Language code: ColumnTypes[tab2]
Wolfram Language code: Normal[tab2]

Take a collection of times:

Wolfram Language code: data = RandomTime[6]

Create a Tabular object with automatic type detection:

Wolfram Language code: tab1 = ToTabular[<|"col" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[tab1]

Specify a type to convert to granularity "Hour" when times are extracted:

Wolfram Language code: tab2 = ToTabular[<|"col" -> data|>, "Columns", <|"ElementType" -> {"Time"::["Integer64", "Hour"]}|>]
Wolfram Language code: ColumnTypes[tab2]
Wolfram Language code: Normal[tab2]

Specify dates with a different calendar:

Wolfram Language code: data = RandomDate[6, CalendarType -> "Jewish"]
Wolfram Language code: tab = ToTabular[<|"col" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[tab]
Wolfram Language code: Normal[tab]

GeoPosition Type  (1)

Take a collection of central geo positions for the countries of South America:

Wolfram Language code: EntityValue[EntityClass["Country", "SouthAmerica"], "Position"]

ToTabular automatically interprets the data as a column of "GeoPosition" type:

Wolfram Language code: tab = ToTabular[<|"col" -> %|>, "Columns"]
Wolfram Language code: ColumnTypes[tab]
Wolfram Language code: GeoGraphics[{Red, PointSize[Large], Point[tab -> "col"]}, GeoBackground -> "Plain"]

Lists & Tuples  (2)

Take a collection of integer tuples:

Wolfram Language code: data = Tuples[{1, 2, 3}, 3]
Wolfram Language code: tab1 = ToTabular[data]
Wolfram Language code: ColumnTypes[%]

Specify the type of the elements of the tuples:

Wolfram Language code: tab2 = ToTabular[<|"col" -> data|>, "Columns", <|"ElementType" -> {"ListVector"["Integer8", 3]}|>]
Wolfram Language code: ColumnTypes[tab2]

Take a collection of tuples of objects of various types:

Wolfram Language code: data = Tuples[{{"cat", "dog", "fox"}, {1, 2, 3}, {True, False}}]

Create a Tabular object with automatic type detection:

Wolfram Language code: tab1 = ToTabular[<|"col1" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[tab1]

Specify the types of the elements of the tuples:

Wolfram Language code: tab2 = ToTabular[<|"col" -> data|>, "Columns", <|"ElementType" -> {"ListTuple"["String", "Integer8", "Boolean"]}|>]
Wolfram Language code: ColumnTypes[tab2]

General Expressions  (1)

Take a collection of regions:

Wolfram Language code: data = Region[RegularPolygon[#]]& /@ Range[3, 8]

Creating a Tabular object assigns type "Expression" to general Wolfram Language expressions:

Wolfram Language code: ToTabular[<|"col" -> data|>, "Columns"]
Wolfram Language code: ColumnTypes[%]

Data Forms  (2)

Extract the component types of a TimeSeries object:

Wolfram Language code: TimeSeries[{{1, "dog"}, {4, "cat"}, {3, "fox"}}, {Today}, ComponentKeys -> {"number", "animal"}]
Wolfram Language code: ColumnTypes[%]

The association includes the type of the "Timestamp" column of the corresponding Tabular object:

Wolfram Language code: Tabular[%%]

Take a simple TimeSeries object:

Wolfram Language code: TimeSeries[Quantity[{2.5, 3.2, 1.9}, "Volts"], {0}]

The timestamp component has numeric or date type, while the value component can be of any type:

Wolfram Language code: ColumnTypes[%]

Column Selectors  (1)

Get column types for all columns:

Wolfram Language code: tab = Tabular[{{1, 2.3, "dog", True}, {2, 1.8, "cat", False}}, {"col1", "col2", "col3", "col4"}]
Wolfram Language code: ColumnTypes[tab]

Extract column types for two columns:

Wolfram Language code: ColumnTypes[tab][[{"col1", "col3"}]]

Extract columns of Boolean type:

Wolfram Language code: ColumnTypes[tab, "Boolean"]

Extract columns of any integer type:

Wolfram Language code: ColumnTypes[tab, "Integer*"]

Extract columns that are either string or Boolean:

Wolfram Language code: ColumnTypes[tab, "String" | "Boolean"]

Applications  (1)

Create a TabularRow with automatic input type detection:

Wolfram Language code: TabularRow[{1, "cat", Today}]

Column types:

Wolfram Language code: ColumnTypes[%]

Specify types:

Wolfram Language code: TabularRow[{1, "cat", Today}, <|"ElementType" -> {"Integer8", "Categorical"[{"cat", "dog", "fox"}], Automatic}|>]

Column types:

Wolfram Language code: ColumnTypes[%]
Wolfram Research (2025), ColumnTypes, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnTypes.html (updated 2026).

Text

Wolfram Research (2025), ColumnTypes, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnTypes.html (updated 2026).

CMS

Wolfram Language. 2025. "ColumnTypes." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. 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

BibTeX

@misc{reference.wolfram_2026_columntypes, author="Wolfram Research", title="{ColumnTypes}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/ColumnTypes.html}", note=[Accessed: 15-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_columntypes, organization={Wolfram Research}, title={ColumnTypes}, year={2026}, url={https://reference.wolfram.com/language/ref/ColumnTypes.html}, note=[Accessed: 15-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /