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
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Creating Tabular Objects  
Extracting Data  
Cleaning Data  
Transforming Data  
Options  
Alignment  
Background  
BaselinePosition  
Show More Show More
ImageSize  
ItemDisplayFunction  
ItemSize  
ItemStyle  
Scrollbars  
ScrollPosition  
Applications  
Properties & Relations  
Possible Issues  
See Also
Related Guides
History
Cite this Page

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 »
    TimeSeries[…]collection of sampled time-value pairs
    EventSeries[…]series of temporal events
  • 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.
  • Tabular[tabular,options] applies the given options to a Tabular object.
  • The following options control the overall appearance of Tabular:
  • AllowedDimensionsAutomaticrestrictions on the number of rows or columns
    AppearanceElementsAutomaticelements to include in the displayed view
    BaselinePosition Automaticwhat to align with a surrounding text baseline
    BaseStyle{}base style specifications for the tabular
    ImageMarginsAutomaticmargins around the displayed tabular
    ImageSize Automaticthe overall size of the table view
    Scrollbars {Automatic,Automatic}whether to include scrollbars
    ScrollPosition Automaticscroll position if scrolling is enabled
  • Possible elements in AppearanceElements include "RowHeaders", "CollapsedRowHeaders", "ColumnHeaders", "CollapsedColumnHeaders", "Frame" and "ResizeArea".
  • Tabular takes the following options that determine the appearance of the tabular content:
  • AlignmentAutomatichorizontal and vertical alignment of items
    BackgroundNonewhat background colors to use
    DividersAutomaticwhether to include dividers between cells
    HeaderAlignmentAutomatichorizontal and vertical alignments of headers
    HeaderBackgroundAutomaticbackground colors to use for headers
    HeaderSizeAutomaticwidth and height of headers
    HeaderStyleAutomaticstyles to use for headers
    ItemDisplayFunctionNonefunction to use to format items
    ItemSizeAutomaticwidth and height of each item
    ItemStyle{}styles for columns and rows
  • The content options take the form opt<|"elem"spec,…|>, where "elem" specifies which elements the spec is affecting.
  • Possible elements are:
  • "Columns"{s1,s2,…}style columns by position
    "Rows"{s1,s2,…}style rows by position
    "ColumnRules"{col1s1,…}style columns by keys
    "RowRules"{row1s1,…}style rows by index
    "ItemRules"{{row1,col1}s1,…}style items by row and column
    "ColumnValueFunction"cfstyle columns by values
    "RowValueFunction"rfstyle rows by values
    "ItemValueFunction"ifstyle items by value
  • "Columns" and "Rows" take the following forms:
  • {s1,s2,…,sn}use s1 through sn, then use defaults
    suse s in all cases
    Cyclic[{c1,c2,…}]cycle through all ci
    {s1,s2,…,Cyclic[{c1,c2,…}],sm,…,sn}use the first sequence of si at the beginning, then cyclically use the ci, then use the last sequence of si at the end
    {s1,s2,…,Cyclic[{}],sm,…,sn}use the first sequence of si at the beginning and the last sequence at the end
  • The columns coli can be a column key "key" or the numerical index i of the column.
  • The row rowi can be the numerical index i of the row, or RowKey[{…}] if Tabular contains key columns.
  • "RowValueFunction"f applies the function f to each row of data, and it should either return a setting to use for the entire row or a list of keyval results indicating what settings to use per column.
  • "ItemValueFunction" takes the following forms:
  • itfnuse itfn to generate the setting for every item
    {col1itfn1,…}}use itfni to generate the setting for items in column coli
  • The arguments supplied to item value functions are the value val of the item, the position {row,col} in the tabular and the entire tabular object tab.
  • "RowValueFunction" takes the following forms:
  • rwfnuse rwfn to generate the setting for every item
    {col1rwfni,…}}use rwfn to generate the setting for items in column coli
  • The arguments supplied to row value functions are the association of row elements assoc, the row position row in the tabular and the entire tabular object tab.

Examples

open all close all

Basic Examples  (5)

Create a Tabular object from a matrix:

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

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

Wolfram Language code: Tabular[{{1, x, Today}, {4, y, Tomorrow}}, {"col1", "col2", "col3"}]

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

Wolfram Language code: Tabular[{<|"a" -> 1, "b" -> 2, "c" -> 3|>, <|"a" -> 4, "b" -> 5, "c" -> 6|>}]

Create a Tabular object from a list of columns:

Wolfram Language code: ToTabular[{"a" -> {1, 4}, "b" -> {2, 5}, "c" -> {3, 6}}, "Columns"]

Create a Tabular object from a Dataset:

Wolfram Language code: Tabular[Dataset[{Association["a" -> 1, "b" -> 2, "c" -> 3], Association["a" -> 4, "b" -> 5, "c" -> 6]}]]

Scope  (27)

Creating Tabular Objects  (11)

Construct a Tabular object from a list of rows:

Wolfram Language code: Tabular[{{"M", 8.1, 16.1}, {"M", 13.9, 29.2}, {"M", 16.1, 33.8}, {"F", 7.2, 14.7}, {"F", 14.9, 30.1}}]

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

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

Construct a Tabular object from a list of associations:

Wolfram Language code: Tabular[{<|"name" -> "John", "age" -> 25|>, <|"name" -> "Anne", "age" -> 20|>, <|"name" -> "Rob", "age" -> Missing[]|>}]

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

Wolfram Language code: Tabular[{<|ExtendedKey["AA", "a"] -> 1, ExtendedKey["AA", "b"] -> 2|>, <|ExtendedKey["AA", "a"] -> 3, ExtendedKey["AA", "b"] -> 4|>}]

Create a Tabular object from a QuantityArray:

Wolfram Language code: qa = QuantityArray[RandomReal[1, {6, 3}], {"Meters", "Seconds", "Grams"}]
Wolfram Language code: Tabular[qa]

Tabular object from column-oriented list data requires Transpose:

Wolfram Language code: dates = RandomDate[5, DateGranularity -> "Day"]
Wolfram Language code: values = {1.2, 7.3, 3.8, 4.2, 4.5};
Wolfram Language code: Tabular[Transpose[{dates, values}], {"date", "value"}]

Use ToTabular instead:

Wolfram Language code: ToTabular[{"date" -> dates, "value" -> values}, "Columns"]

Convert a Dataset into a Tabular object:

Wolfram Language code: data = Take[ExampleData[{"Dataset", "Planets"}], 4]

Converting to Tabular will flatten the dataset structure:

Wolfram Language code: Tabular[data]

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

Wolfram Language code: Import["ExampleData/TreesOwnedByTheCityOfChampaign.csv", "Tabular"]

Import a "TSV" file:

Wolfram Language code: Import["ExampleData/RetailSales.tsv", "Tabular"]

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

Wolfram Language code: Tabular[{{1, 2}, {3, 4}, {5, 6}}, <|"ElementType" -> {"Integer64", "Integer16"}|>]

Check the types stored:

Wolfram Language code: ColumnTypes[%]

Mix columns of different types:

Wolfram Language code: Tabular[{{1, "dog", True}, {2, "cow", False}}, <|"ElementType" -> {"Integer8", "String", "Boolean"}|>]

Check the types stored:

Wolfram Language code: ColumnTypes[%]

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

Wolfram Language code: EntityValue["Country", {"Area", "HighestElevation", "Population", "PopulationDensity"}, "Tabular"]

Extracting Data  (9)

Extract a single element:

Wolfram Language code: tab = Tabular[{{1, 2}, {3, 4}}]
Wolfram Language code: tab[[1, 2]]

Extract a single element Tabular object:

Wolfram Language code: tab[[{1}, {2}]]
Wolfram Language code: Normal[%]

Extract a row:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}}]
Wolfram Language code: %[[1]]
Wolfram Language code: Normal[%]

Extract a column:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}}]
Wolfram Language code: %[[All, 1]]
Wolfram Language code: Normal[%]

Extract a column using a column key:

Wolfram Language code: tab = Tabular[{<|"a" -> 1, "b" -> 0|>, <|"a" -> 1, "b" -> 1|>, <|"a" -> 2, "b" -> 0|>, <|"a" -> 2, "b" -> 1|>}]
Wolfram Language code: tab[[All, "b"]]
Wolfram Language code: Normal[%]

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

Wolfram Language code: tab = Tabular[{{"one", True, "foo"}, {"two", False, "bar"}}, <|"ColumnKeys" -> {"key", "col1", "col2"}, "KeyColumns" -> {"key"}|>]
Wolfram Language code: tab[Key["one"]]
Wolfram Language code: tab[RowKey["one"]]
Wolfram Language code: tab[<|"key" -> "one"|>]

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

Wolfram Language code: tab = Tabular[{{"one", True, "foo"}, {"two", False, "bar"}}, <|"ColumnKeys" -> {"key1", "key2", "col"}, "KeyColumns" -> {"key1", "key2"}|>]
Wolfram Language code: tab[Key[{"one", True}]]
Wolfram Language code: tab[RowKey[{"one", True}]]
Wolfram Language code: tab[<|"key1" -> "one", "key2" -> True|>]

Extract multiple columns from a Tabular object:

Wolfram Language code: tab = ResourceData["Sample Tabular Data: Fisher Iris"]

Extract two columns and reverse their order:

Wolfram Language code: tab[[All, {3, 2}]]

Extract multiple columns by column keys:

Wolfram Language code: tab[[All, {"Species", "PetalLength", "SepalLength"}]]

Use conditions to select rows:

Wolfram Language code: tab = ResourceData["Sample Tabular Data: Fisher Iris"]

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

Wolfram Language code: Select[tab, #SepalLength >= Quantity[7, "Centimeters"]&]

Use column type to select columns:

Wolfram Language code: tab = Tabular[{{"M", 8.1, 16.1}, {"M", 13.9, 29.2}, {"M", 16.1, 33.8}, {"F", 7.2, 14.7}, {"F", 14.9, 30.1}}, {"MF", "val1", "val2"}]

Select columns of numeric type:

Wolfram Language code: ColumnKeys[tab, #ElementType === "Real64"&]
Wolfram Language code: tab[All, %]

Cleaning Data  (4)

Take a Tabular object of country data:

Wolfram Language code: tab = EntityValue[EntityClass["Country", "Europe"], {"Population", "Area"}, "Tabular"]

Sort by decreasing values of population:

Wolfram Language code: ReverseSortBy[tab, "Population"]

Find the country with the smallest area:

Wolfram Language code: MinimalBy[tab, "Area"]

Remove a column:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"col1", "col2"}]
Wolfram Language code: DeleteColumns[%, "col2"]

Insert a column:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"col1", "col2"}]
Wolfram Language code: InsertColumns[%, "col3" -> {"a", "b", "c"}]

Rename a column:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"col1", "col2"}]
Wolfram Language code: RenameColumns[%, "col2" -> "c2"]

Transforming Data  (3)

Construct a new column:

Wolfram Language code: times = DateRange[Today, Today + Quantity[4, "Days"]]; values = {1.2, 7.3, 3.8, 4.2, 4.5}; Tabular[Transpose[{times, values}], {"date", "value"}]

Keep the last column with the new one:

Wolfram Language code: ConstructColumns[%, {"day" -> Function[DayName[#date]], "value"}]

Transform an existing column:

Wolfram Language code: dates = {"Sep 1, 2024", "Sep 2, 2024", "Sep 3, 2024"}; values = {1.2, 7.3, 3.8}; Tabular[Transpose[{dates, values}], {"date", "value"}]
Wolfram Language code: TransformColumns[%, "date" -> Function[FromDateString[#date]]]

Population and area of European countries:

Wolfram Language code: tab = EntityValue[EntityClass["Country", "Europe"], {"Population", "Area"}, "Tabular"]

Compute population density:

Wolfram Language code: TransformColumns[tab, "Density" -> Function[#Population / #Area]]

Options  (46)

Alignment  (10)

Specify alignments for every column:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, Alignment -> <|"Columns" -> {Left, Center, Right}|>]

If there are more columns than alignments, the later columns use default alignment:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"Columns" -> {Center, Left}|>]

Cycle between left and right column alignments:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"Columns" -> Cyclic[{Left, Right}]|>]

Start and end with center-aligned columns and cycle between left and right in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"Columns" -> {Center, Cyclic[{Left, Right}], Center}|>]

Start and end with left-aligned columns and use the default alignment in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"Columns" -> {Left, Cyclic[{}], Left}|>]

Left-align the column "b":

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"ColumnRules" -> {"b" -> Left}|>]

Specify the alignment of an item using its {row,col} position:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"ItemRules" -> {{3, "b"} -> Left}|>]

Left-align rows if the value in column "b" is more than 10 and right-align otherwise:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"RowValueFunction" -> (If[#b > 10, Left, Right]&)|>]

Use None to use the default alignment:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"RowValueFunction" -> (If[#b > 10, Left, None]&)|>]

Left-align items if the value is even and center-align them otherwise:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"ItemValueFunction" -> (If[EvenQ[#], Left, Center]&)|>]

Use None to use the default alignment:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"ItemValueFunction" -> (If[EvenQ[#], Left, None]&)|>]

Align the "b" column based on its value:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Alignment -> <|"ItemValueFunction" -> {"b" -> (If[# > 10, Left, Right]&)}|>]

Background  (13)

Use a single style as the background for all the items:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, Background -> RGBColor[0.95, 0.627, 0.1425]]

Specify backgrounds for every column:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, Background -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}|>]

Specify backgrounds for every row:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, Background -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], RGBColor[0.95, 0.627, 0.1425]}|>]

If there are more columns than styles, the later columns use default styling:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}|>]

If there are more rows than styles, the later rows use default styling:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], RGBColor[0.95, 0.627, 0.1425]}|>]

Cycle between blue and green column backgrounds:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"Columns" -> Cyclic[{RGBColor[0.24, 0.6, 0.8], RGBColor[0.455, 0.7, 0.21]}]|>]

Cycle between blue and green row backgrounds:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}}, {"a", "b", "c", "d", "e"}, Background -> <|"Rows" -> Cyclic[{RGBColor[0.24, 0.6, 0.8], RGBColor[0.455, 0.7, 0.21]}]|>]

Start and end with blue and red column backgrounds, and cycle between orange and green in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Start and end with blue and red row backgrounds, and cycle between orange and green in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}}, {"a", "b", "c", "d", "e"}, Background -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Start and end with blue and red column backgrounds, and use the default styling in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Start and end with blue and red row backgrounds, and use the default styling in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}}, {"a", "b", "c", "d", "e"}, Background -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Use a blue background for the column "b":

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"ColumnRules" -> {"b" -> RGBColor[0.24, 0.6, 0.8]}|>]

Use a blue background for the second row:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"RowRules" -> {2 -> RGBColor[0.24, 0.6, 0.8]}|>]

Use RowKey[{…}] to style a row:

Wolfram Language code: Tabular[{{"apple", 2, 3, 4, 5}, {"banana", 7, 8, 9, 10}, {"grape", 12, 13, 14, 15}}, <|...|>, Background -> <|"RowRules" -> {RowKey[{"banana"}] -> RGBColor[0.24, 0.6, 0.8]}|>]

Specify the background style of an item using its {row,col} position:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"ItemRules" -> {{3, "b"} -> RGBColor[0.24, 0.6, 0.8]}|>]

Color row backgrounds red if the value in column "b" is more than 10, and blue otherwise:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"RowValueFunction" -> (If[#b > 10, RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)|>]

Use None to use the default background style:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"RowValueFunction" -> (If[#b > 10, RGBColor[0.91, 0.318, 0.243], None]&)|>]

Color the second row based on the "b" column's value:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"RowValueFunction" -> {2 -> (If[#b > 10, RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)}|>]

Color item backgrounds red if the value is even, and blue otherwise:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"ItemValueFunction" -> (If[EvenQ[#], RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)|>]

Use None to use the default background style:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"ItemValueFunction" -> (If[EvenQ[#], RGBColor[0.91, 0.318, 0.243], None]&)|>]

Color the "b" column based on its value:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, Background -> <|"ItemValueFunction" -> {"b" -> (If[# > 10, RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)}|>]

BaselinePosition  (1)

Align the center of the tabular with the baseline of surrounding text:

Wolfram Language code: {x, y, Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, BaselinePosition -> Center], z}

Align the bottom of the tabular with the baseline:

Wolfram Language code: {x, y, Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, BaselinePosition -> Bottom], z}

ImageSize  (5)

By default, the width is limited by the notebook size, and a limited number of rows are shown:

Wolfram Language code: ResourceData["Sample Tabular Data: Car Models"]

Use a named size to show less of the Tabular object:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ImageSize -> Small]

Limit the width of a Tabular object:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ImageSize -> 300]

Limit the width and height of a Tabular object:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ImageSize -> {300, 100}]

Limit the overall height of a Tabular object:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ImageSize -> {Automatic, 100}]

ItemDisplayFunction  (1)

Use ItemDisplayFunction to change how missing values should be displayed:

Wolfram Language code: Tabular[{{9, Missing[], 2, 3, 3}, {6, 3, 1, 3, 10}, {1, 7, 4, Missing[], Missing[]}, {5, 7, 6, 4, 3}, {9, 5, 4, 9, 6}}, ItemDisplayFunction -> (If[MissingQ[#], Style["●", StandardRed], #]&)]

ItemSize  (1)

Increase the height of items with ItemSize:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ItemSize -> 3]

Specify the width and height of items:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ItemSize -> {10, 3}]

Use Cyclic to assign a repeating item size from the second column to the last:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ItemSize -> {{15, Cyclic[{5}]}, Automatic}]

ItemStyle  (13)

Use a single style as the style for all the items:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, ItemStyle -> Bold]

Use Directive to combine styles into a single style:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, ItemStyle -> Directive[Bold, Italic]]

Specify styles for every column:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, ItemStyle -> <|"Columns" -> {Bold, Italic, Red}|>]

Specify styles for every row:

Wolfram Language code: Tabular[{{1, 2, 3}, {4, 5, 6}}, {"a", "b", "c"}, ItemStyle -> <|"Rows" -> {Bold, Red}|>]

If there are more columns than styles, the later columns use default styling:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}|>]

If there are more rows than styles, the later rows use default styling:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], RGBColor[0.95, 0.627, 0.1425]}|>]

Cycle between blue and green column styles:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Columns" -> Cyclic[{RGBColor[0.24, 0.6, 0.8], RGBColor[0.455, 0.7, 0.21]}]|>]

Cycle between blue and green row styles:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Rows" -> Cyclic[{RGBColor[0.24, 0.6, 0.8], RGBColor[0.455, 0.7, 0.21]}]|>]

Start and end with blue and red column styles, and cycle between orange and green in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Start and end with blue and red row styles, and cycle between orange and green in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{RGBColor[0.95, 0.627, 0.1425], RGBColor[0.455, 0.7, 0.21]}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Start and end with blue and red column styles, and use the default styling in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Columns" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Start and end with blue and red row styles, and use the default styling in between:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"Rows" -> {RGBColor[0.24, 0.6, 0.8], Cyclic[{}], RGBColor[0.922526, 0.385626, 0.209179]}|>]

Use a blue style for the column "b":

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"ColumnRules" -> {"b" -> RGBColor[0.24, 0.6, 0.8]}|>]

Use a blue style for the second row:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"RowRules" -> {2 -> RGBColor[0.24, 0.6, 0.8]}|>]

Use RowKey[{…}] to style a row:

Wolfram Language code: Tabular[{{"apple", 2, 3, 4, 5}, {"banana", 7, 8, 9, 10}, {"grape", 12, 13, 14, 15}}, <|...|>, ItemStyle -> <|"RowRules" -> {RowKey[{"banana"}] -> RGBColor[0.24, 0.6, 0.8]}|>]

Specify the styles style of an item using its {row,col} position:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"ItemRules" -> {{3, "b"} -> RGBColor[0.24, 0.6, 0.8]}|>]

Color row styles red if the value in column "b" is more than 10, and blue otherwise:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"RowValueFunction" -> (If[#b > 10, RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)|>]

Use None to use the default style:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"RowValueFunction" -> (If[#b > 10, RGBColor[0.91, 0.318, 0.243], None]&)|>]

Color the second column based on the "b" column's value:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"RowValueFunction" -> {2 -> (If[#b > 10, RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)}|>]

Color items red if the value is even, and blue otherwise:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"ItemValueFunction" -> (If[EvenQ[#], RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)|>]

Use None to use the default style:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"ItemValueFunction" -> (If[EvenQ[#], RGBColor[0.91, 0.318, 0.243], None]&)|>]

Color the "b" column based on its value:

Wolfram Language code: Tabular[{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}}, {"a", "b", "c", "d", "e"}, ItemStyle -> <|"ItemValueFunction" -> {"b" -> (If[# > 10, RGBColor[0.91, 0.318, 0.243], RGBColor[0.24, 0.6, 0.8]]&)}|>]

Scrollbars  (1)

Scrollbars are shown when the tabular is larger than the displaying size:

Wolfram Language code: Tabular[RandomReal[1, {20, 15}]]

Hide the column scrollbar:

Wolfram Language code: Tabular[RandomReal[1, {20, 15}], Scrollbars -> {True, False}]

Use no scrollbars:

Wolfram Language code: Tabular[RandomReal[1, {20, 15}], Scrollbars -> False]

ScrollPosition  (1)

By default, the scrollbars are positioned to display the top-left corner of the content:

Wolfram Language code: Tabular[RandomReal[1, {20, 15}], ScrollPosition -> Automatic]

Specify a custom initial position of the scrollbars measured in points:

Wolfram Language code: Tabular[RandomReal[1, {20, 15}], ScrollPosition -> {250, 0}]

ScrollPosition can be Dynamic objects:

Wolfram Language code: Row[{Column[{Slider[Dynamic[h], {0, 500, 1}], Tabular[RandomReal[1, {20, 15}], ScrollPosition -> Dynamic[{h, v}], Scrollbars -> False, ImageSize -> {400, 300}]}], VerticalSlider[Dynamic[v], {300, 0}]}]

Applications  (3)

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

Wolfram Language code: name = {"Statistics", "FisherIris"};
Wolfram Language code: ExampleData[name, "LongDescription"]

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

Wolfram Language code: tab = Tabular[ExampleData[name], ExampleData[name, "ColumnHeadings"]]

Plot petal length as a function of sepal length:

Wolfram Language code: ListPlot[tab -> {"SepalLength", "PetalLength"}]

Find correlation coefficient:

Wolfram Language code: AggregateRows[tab, "corr" -> Function[Correlation[#SepalLength, #PetalLength]]]

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

Wolfram Language code: AggregateRows[tab, {"SepalLengthMean" -> Function[Mean[#SepalLength]], "SepalWidthMean" -> Function[Mean[#SepalWidth]], "PetalLengthMean" -> Function[Mean[#PetalLength]], "PetalWidthMean" -> Function[Mean[#PetalWidth]]}, "Species"]

Information about "DuneBooks" in Tabular form:

Wolfram Language code: EntityValue[EntityClass["Book", "DuneBooks"], {"FirstPublished", "Author", "Image"}, "Tabular"]

Use ItemDisplayFunction to show a distribution glyph for a Tabular column and mark the current item’s value on the glyph.

First, generate the distribution plot with SmoothHistogram:

Wolfram Language code: g = SmoothHistogram[ResourceData["Sample Tabular Data: Car Models"] -> "mpg", PlotStyle -> LightGray, Axes -> None, AspectRatio -> 1 / 3, PlotRangePadding -> Scaled[.05], PlotInteractivity -> False]

Create a glyph function that adds a marker at the item value:

Wolfram Language code: mpgGlyph[v_] := Labeled[Show[g, Epilog -> {RGBColor[0.91, 0.318, 0.243], Thick, InfiniteLine[{{v, 0}, {v, 1}}]}], v, Right]
Wolfram Language code: mpgGlyph[20]

Apply to the tabular column "mpg" with ItemDisplayFunction:

Wolfram Language code: Tabular[ResourceData["Sample Tabular Data: Car Models"], ItemDisplayFunction -> <|"mpg" -> (mpgGlyph[#]&)|>]

Properties & Relations  (3)

Use TabularQ to test if a Tabular object is valid:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}}]
Wolfram Language code: TabularQ[%]

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

Wolfram Language code: tab = Tabular[{{a, b}, {c, d}, {e, f}}]

First column:

Wolfram Language code: tab[All, 1]
Wolfram Language code: Normal[%]

Second column:

Wolfram Language code: tab[All, 2]
Wolfram Language code: Normal[%]

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

Wolfram Language code: tab = Tabular[{{a, b, c}, {d, e, f}}]

First row:

Wolfram Language code: tab[1]
Wolfram Language code: Normal[%]

Second row:

Wolfram Language code: tab[2]
Wolfram Language code: Normal[%]

Possible Issues  (3)

Tabular input data must be at least two dimensional:

Wolfram Language code: Tabular[{x, y, z}]

Create a single row:

Wolfram Language code: Tabular[{{x, y, z}}]

Create a single column:

Wolfram Language code: Tabular[List /@ {x, y, z}]

Raggedness in the second level is not accepted:

Wolfram Language code: Tabular[{{a, b}, {c}}]

Arrays must be rectangular in the first two levels:

Wolfram Language code: Tabular[{{{a, b}, {c, d}}, {{A, B, X}, {C, D}}}]

Alternatively, use padding:

Wolfram Language code: Tabular[PadRight[{{a, b}, {c}}, Automatic, Missing[]]]

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

Wolfram Language code: tab = Tabular[{{1, True, Today}, {2, False, Tomorrow}}, {"col", "bool", "date"}]
Wolfram Language code: tab[[All, {"col", "col"}]]

Map the Part extraction to generate duplicate columns:

Wolfram Language code: tab[[All, #]]& /@ {"col", "col"}

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

Wolfram Language code: {Tabular[%], Tabular[%, {"a", "b"}]}
Wolfram Research (2025), Tabular, Wolfram Language function, https://reference.wolfram.com/language/ref/Tabular.html (updated 2025).

Text

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

CMS

Wolfram Language. 2025. "Tabular." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. 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_2026_tabular, author="Wolfram Research", title="{Tabular}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Tabular.html}", note=[Accessed: 22-August-2026]}

BibLaTeX

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