Skip to main content
Version: Java (Groovy)

dropColumns

The dropColumns method creates a table with the same number of rows as the source table but omits any columns included in the arguments.

Syntax

table.dropColumns(columnNames...)

Parameters

ParameterTypeDescription
columnNamesString...

Columns that will be omitted in the new table.

columnNamesCollection<String>

Columns that will be omitted in the new table.

columnNamesColumnName...

Columns that will be omitted in the new table.

Returns

A new table that includes the same number of rows as the source table, with the specified column names omitted.

Examples

source = newTable(
stringCol("A", "apple", "apple", "orange", "orange", "plum", "plum"),
intCol("B", 1, 1, 2, 2, 3, 3),
stringCol("C", "Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"),
intCol("D", 1, 2, 12, 3, 2, 3)
)

result = source.dropColumns("B","D")