Documentation

toFloat() function

Flux 0.7.0+

The toFloat() function converts all values in the _value column to floats.

toFloat()

To convert values in a column other than _value, define a custom function patterned after the function definition, but replace _value with your desired column.

Supported data types

Parameters

tables

Input data. Default is piped-forward data (<-).

Examples

The following examples use data provided by the sampledata package to show how toFloat() transforms data.

Convert an integer value column to a float column

import "sampledata"

sampledata.int()
  |> toFloat()

View input and output

Convert a boolean value column to a float column

import "sampledata"

sampledata.bool()
  |> toFloat()

View input and output

Function definition

toFloat = (tables=<-) =>
  tables
    |> map(fn:(r) => ({ r with _value: float(v: r._value) }))

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.