Documentation

drop() function

Flux 0.7.0+

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"])

View input and output

Drop columns matching a predicate

import "sampledata"

sampledata.int()
  |> drop(fn: (column) => column =~ /^t/)

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.