float() function
float()
converts a value to a float type.
Function type signature
(v: A) => float
Parameters
v
(Required) Value to convert.
Examples
- Convert a string to a float
- Convert a scientific notation string to a float
- Convert an integer to a float
- Convert all values in a column to floats
Convert a string to a float
float(v: "3.14")// Returns 3.14
Convert a scientific notation string to a float
float(v: "1.23e+20")// Returns 1.23e+20 (float)
Convert an integer to a float
float(v: "10")// Returns 10.0
Convert all values in a column to floats
If converting the _value
column to float types, use toFloat()
.
If converting columns other than _value
, use map()
to iterate over each
row and float()
to convert a column value to a float type.
data
|> map(fn: (r) => ({r with exampleCol: float(v: r.exampleCol)}))
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:
Customers with an annual or support contract can contact InfluxData Support.