WOLFRAM

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:
  • tpatttype pattern
    tclassnamed 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 all

Basic Examples  (3)Summary of the most common use cases

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

Out[1]=1
Out[2]=2

Find the types of the columns of reals:

Out[1]=1
Out[2]=2

Construct a Tabular object without keys from a numeric matrix:

Out[1]=1

Find the list of types of each column:

Out[2]=2

Scope  (15)Survey of the scope of standard use cases

Numeric Types  (1)

Take a collection of integers or missing values:

Out[2]=2

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

Out[3]=3

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

Out[4]=4

Check the stored types:

Out[5]=5

Boolean Type  (1)

Take a collection of Boolean or missing values:

Out[1]=1

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

Out[2]=2
Out[3]=3

String Type  (1)

Take a collection of words or missing values:

Out[1]=1

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

Out[2]=2
Out[3]=3

Quantity Types  (2)

Take a collection of Quantity durations and missing values:

Out[1]=1
Out[2]=2

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

Out[3]=3

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

Out[4]=4

Specify the magnitude type and unit to use:

Out[5]=5
Out[6]=6

The original input was not cached:

Out[7]=7

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

Out[1]=1
Out[2]=2
Out[3]=3

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

Out[4]=4
Out[5]=5

Date & Time Types  (3)

Take a collection of dates:

Out[1]=1

Create a Tabular object with automatic type detection:

Out[2]=2
Out[3]=3

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

Out[4]=4
Out[5]=5
Out[6]=6

Take a collection of times:

Out[1]=1

Create a Tabular object with automatic type detection:

Out[2]=2
Out[3]=3

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

Out[4]=4
Out[5]=5
Out[6]=6

Specify dates with a different calendar:

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4

Categorical Type  (2)

Take a collection of strings:

Out[1]=1

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

Out[2]=2
Out[3]=3

Explicitly specify a "Categorical" type for the column, categorizing the data:

Out[4]=4
Out[5]=5

Extract the categories:

Out[6]=6
Out[7]=7

Split a gene sequence into a list of the nucleotide bases:

Create a Tabular object with specific categories of the nucleotide bases:

Out[2]=2
Out[3]=3
Out[4]=4

Visualize the beginning of the sequence:

Out[5]=5

Categorical Ordered Type  (1)

Take a collection of sizes:

Out[1]=1
Out[2]=2

Create a Tabular object with automatic type detection:

Out[3]=3

The automatically detected type is "String":

Out[4]=4

Specify the "CategoricalOrdered" type providing the list categories, which defines the ordering:

Out[5]=5
Out[6]=6

Lists & Tuples  (2)

Take a collection of integer tuples:

Out[1]=1
Out[2]=2
Out[3]=3

Specify the type of the elements of the tuples:

Out[4]=4
Out[5]=5

Take a collection of tuples of objects of various types:

Out[1]=1

Create a Tabular object with automatic type detection:

Out[2]=2
Out[3]=3

Specify the types of the elements of the tuples:

Out[4]=4
Out[5]=5

General Expressions  (1)

Take a collection of regions:

Out[1]=1

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

Out[2]=2
Out[3]=3

Column Selectors  (1)

Get column types for all columns:

Out[1]=1
Out[2]=2

Extract column types for two columns:

Out[3]=3

Extract columns of Boolean type:

Out[4]=4

Extract columns of any integer type:

Out[5]=5

Extract columns that are either string or Boolean:

Out[6]=6

Applications  (1)Sample problems that can be solved with this function

Create a TabularRow with automatic input type detection:

Out[1]=1

Column types:

Out[2]=2

Specify types:

Out[3]=3

Column types:

Out[4]=4
Wolfram Research (2025), ColumnTypes, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnTypes.html.
Wolfram Research (2025), ColumnTypes, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnTypes.html.

Text

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

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.

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

Wolfram Language. (2025). ColumnTypes. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColumnTypes.html

BibTeX

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

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

BibLaTeX

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

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