Edit page in Livemark
(2024-01-29 13:37)

Boolean Field

Overview

The field contains boolean (true/false) data.

In the physical representations of data where boolean values are represented with strings, the values set in trueValues and falseValues are to be cast to their logical representation as booleans. trueValues and falseValues are arrays which can be customised to user need. The default values for these are in the additional properties section below. Read more in Table Schema Standard.

Example

from frictionless import Schema, extract, fields

data = [['name'], ['true'], ['false']]
rows = extract(data, schema=Schema(fields=[fields.BooleanField(name='name')]))
print(rows)
{'memory': [{'name': True}, {'name': False}]}

Reference

fields.BooleanField (class)

fields.BooleanField (class)

Field representation

Signature

(*, name: str, title: Optional[str] = None, description: Optional[str] = None, format: str = default, missing_values: List[str] = NOTHING, constraints: Dict[str, Any] = NOTHING, rdf_type: Optional[str] = None, example: Optional[str] = None, schema: Optional[Schema] = None, true_values: List[str] = NOTHING, false_values: List[str] = NOTHING) -> None

Parameters

  • name (str)
  • title (Optional[str])
  • description (Optional[str])
  • format (str)
  • missing_values (List[str])
  • constraints (Dict[str, Any])
  • rdf_type (Optional[str])
  • example (Optional[str])
  • schema (Optional[Schema])
  • true_values (List[str])
  • false_values (List[str])

fields.booleanField.true_values (property)

It defines the values to be read as true values while reading data. The default true values are ["true", "True", "TRUE", "1"].

Signature

List[str]

fields.booleanField.false_values (property)

It defines the values to be read as false values while reading data. The default true values are ["false", "False", "FALSE", "0"].

Signature

List[str]