drop() function
The drop()
function removes specified columns from a table.
Columns are specified either through a list or a predicate function.
When a dropped column is part of the group key, it will be removed from the key.
If a specified column is not present in a table, it will return an error.
drop(columns: ["col1", "col2"])
// OR
drop(fn: (column) => column =~ /usage*/)
Parameters
Make sure fn
parameter names match each specified parameter. To learn why, see Match parameter names.
columns
Columns to removed from input tables.
Mutually exclusive with fn
.
fn
Predicate function
with a column
parameter that returns a boolean value indicating whether or not
the column should be removed from input tables.
Mutually exclusive with columns
.
tables
Input data.
Default is piped-forward data (<-
).
Examples
The following examples use data provided by the sampledata
package
to show how drop()
transforms data.
Drop a list of columns
import "sampledata"
sampledata.int()
|> drop(columns: ["_time", "tid"])
Drop columns matching a predicate
import "sampledata"
sampledata.int()
|> drop(fn: (column) => column =~ /^t/)
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.