DeleteColumns
DeleteColumns[tab,cspec]
deletes the columns specified by cspec from the tabular data tab.
DeleteColumns[cspec]
represents an operator form of DeleteColumns that can be applied to tabular data.
Details
- DeleteColumns is also known as remove columns.
- DeleteColumns is typically used to eliminate columns from tabular data to streamline subsequent processing.
- Possible forms of tabular data tab include:
-
Tabular[…] type-consistent tabular data Dataset[…] general hierarchical data {assoc1,assoc2,…} a list of associations of common keys matrix a matrix - Possible column specifications cspec include:
-
name or Key[name] or ExtendedKey[…] named column ind integer indexed column {col1,…} several columns cmin;;cmax;;step a Span of columns
Examples
open allclose allBasic Examples (1)
Delete a single column from a Tabular object:
Scope (8)
Delete a column from a Tabular object:
Or a Span specification:
It is possible to delete all columns from a Tabular object:
The result has the original number of rows and zero columns:
Delete a column from a Dataset object:
Delete a column from a list of associations with common keys:
Delete a column from a matrix:
Delete the first and the last columns:
Use the operator form of DeleteColumns:
Take a Tabular object:
Delete one column by specifying its column key:
Column keys can also be wrapped in Key or ExtendedKey:
Take a Tabular object with extended column keys:
Delete a column by specifying its complete extended key:
The last subkey of the extended key can be specified if it uniquely identifies the column:
Properties & Relations (5)
The action of DeleteColumns is equivalent to Part extraction of the remaining columns:
Deleting an empty list of columns returns the original object:
DeleteColumns is a special version of TransformColumns:
Delete the selected column using DeleteColumns:
Use TransformColumns to set the selected column to Nothing:
DeleteColumns is a complementary operation to ConstructColumns:
Take a Tabular object and extract a column:
Delete the same column from the Tabular object:
Use InsertColumns to insert the column after column "a" again, now using key "B":
Text
Wolfram Research (2025), DeleteColumns, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteColumns.html.
CMS
Wolfram Language. 2025. "DeleteColumns." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeleteColumns.html.
APA
Wolfram Language. (2025). DeleteColumns. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeleteColumns.html