Tabular

Tabular[data]

creates a tabular object from rectangular data representing a list of rows.

Tabular[data,{key1,key2,}]

sets keyi as the name of column i of the tabular object.

Details and Options

  • Tabular is also known as data frame, table and structured data.
  • Tabular is typically used for data where each column can be thought of as a variable and each row as a measurement. Typically, only a window of data is displayed.
  • Each column has an element type, such as number, string, date or expression. Data entries can be missing.
  • Possible forms of data include:
  • {row1,row2,}matrix as a list of rows »
    {assoc1,assoc2,}list of associations with common keys »
    SparseArray[],QuantityArray[],special matrix representations »
    Dataset[]rectangular dataset »
  • Use ToTabular to convert more types of expressions to Tabular as well as have detailed control over how the conversion is done.
  • Tabular[data,schm] sets or modifies the schema of the tabular data, where schm is given as a TabularSchema object or an association <|"prop1"val1,|>.
  • SQL-backed tabular objects can be created using the following forms for spec in Tabular[spec]:
  • RelationalDatabase[]relational database object containing a single table
    RelationalDatabase[]"table"select a table from a relational database
    <|"RelationalDatabase"RelationalDatabase[],"Query""table"|>extended specification of a table from a database
  • Tabular can recognize and operate with missing or exceptional values, such as Missing[], Null, Infinity, etc.
  • The data elements can be extracted using Part, Select, etc.
  • Tabular can be converted to other forms using FromTabular or Normal.
  • Tabular works with transformation functions such as TransformColumns and AggregateRows.

Examples

open allclose all

Basic Examples  (5)

Create a Tabular object from a matrix:

Create a Tabular object from a matrix, specifying the column keys:

Create a Tabular object from a list of associations with common keys:

Create a Tabular object from a list of columns:

Create a Tabular object from a Dataset:

Scope  (28)

Creating Tabular Objects  (12)

Construct a Tabular object from a list of rows:

Construct a Tabular object from a matrix, specifying column names:

Construct a Tabular object from a list of associations:

Create a Tabular object from a list of associations with ExtendedKey:

Create a Tabular object from a QuantityArray:

Tabular object from column-oriented list data requires Transpose:

Use ToTabular instead:

Convert a Dataset into a Tabular object:

Converting to Tabular will flatten the dataset structure:

Use Import of "CSV" to automatically get a Tabular object:

Import a "TSV" file:

Construct a Tabular object of numbers, specifying the type of the elements of each column:

Check the types stored:

Mix columns of different types:

Check the types stored:

Take a collection of sizes:

Tabular stores them by default as strings:

Convert to "CategoricalOrdered" type, internally storing a single copy of each size value:

Show a Tabular object whose rows correspond to entities and whose columns are entity properties:

Extracting Data  (9)

Extract a single element:

Extract a single element Tabular object:

Extract a row:

Extract a column:

Extract a column using a column key:

Extract a row of a Tabular object with a key column:

Extract a row of a Tabular object with several key columns:

Extract multiple columns from a Tabular object:

Extract two columns and reverse their order:

Extract multiple columns by column keys:

Use conditions to select rows:

Extract all the rows with "SepalLength" greater than or equal to 6:

Use column type to select columns:

Select columns of numeric type:

Cleaning Data  (4)

Take a Tabular object of country data:

Sort by decreasing values of population:

Find the country with the smallest area:

Remove a column:

Insert a column:

Rename a column:

Transforming Data  (3)

Construct a new column:

Keep the last column with the new one:

Transform an existing column:

Population and area of European countries:

Compute population density:

Applications  (2)

Use a Tabular object to display column data with separate column headings:

Use the array data and "ColumnHeadings" property to create a Tabular object:

Plot petal length as a function of sepal length:

Find correlation coefficient:

Compute mean values of flower measurements depending on the species type:

Information about "DuneBooks" in Tabular form:

Properties & Relations  (3)

Use TabularQ to test if a Tabular object is valid:

The columns of a Tabular object are given as TabularColumn objects:

First column:

Second column:

The rows of a Tabular object are given as TabularRow objects:

First row:

Second row:

Possible Issues  (3)

Tabular input data must be at least two dimensional:

Create a single row:

Create a single column:

Raggedness in the second level is not accepted:

Arrays must be rectangular in the first two levels:

Alternatively, use padding:

A Tabular object cannot have repeated column keys, which makes Part eliminate duplicates:

Map the Part extraction to generate duplicate columns:

Create a Tabular object without column keys or with different column keys:

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

Text

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

CMS

Wolfram Language. 2025. "Tabular." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Tabular.html.

APA

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

BibTeX

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

BibLaTeX

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