content/flux/v0/stdlib/universe/tobool.md
toBool() converts all values in the _value column to boolean types.
true or false1 or 01 or 01.0 or 0.0(<-tables: stream[{A with _value: B}]) => stream[{A with _value: B, _value: bool}]
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Input data. Default is piped-forward data (<-).
import "sampledata"
sampledata.numericBool()
|> toBool()
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | 1 | t1 |
| 2021-01-01T00:00:10Z | 1 | t1 |
| 2021-01-01T00:00:20Z | 0 | t1 |
| 2021-01-01T00:00:30Z | 1 | t1 |
| 2021-01-01T00:00:40Z | 0 | t1 |
| 2021-01-01T00:00:50Z | 0 | t1 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | 0 | t2 |
| 2021-01-01T00:00:10Z | 1 | t2 |
| 2021-01-01T00:00:20Z | 0 | t2 |
| 2021-01-01T00:00:30Z | 1 | t2 |
| 2021-01-01T00:00:40Z | 1 | t2 |
| 2021-01-01T00:00:50Z | 0 | t2 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | true | t1 |
| 2021-01-01T00:00:10Z | true | t1 |
| 2021-01-01T00:00:20Z | false | t1 |
| 2021-01-01T00:00:30Z | true | t1 |
| 2021-01-01T00:00:40Z | false | t1 |
| 2021-01-01T00:00:50Z | false | t1 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | false | t2 |
| 2021-01-01T00:00:10Z | true | t2 |
| 2021-01-01T00:00:20Z | false | t2 |
| 2021-01-01T00:00:30Z | true | t2 |
| 2021-01-01T00:00:40Z | true | t2 |
| 2021-01-01T00:00:50Z | false | t2 |
{{% /expand %}} {{< /expand-wrapper >}}