Edit page in Livemark
(2024-09-28 08:45)

Number Field

Overview

The field contains numbers of any kind including decimals. Read more in Table Schema Standard.

Example

from frictionless import Schema, extract, fields

data = [['name'], ['1.1'], ['2.2'], ['3.3']]
rows = extract(data, schema=Schema(fields=[fields.NumberField(name='name')]))
print(rows)
{'memory': [{'name': Decimal('1.1')}, {'name': Decimal('2.2')}, {'name': Decimal('3.3')}]}

Reference

fields.NumberField (class)

fields.NumberField (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, bare_number: bool = True, float_number: bool = False, decimal_char: str = ., group_char: str = ) -> 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])
  • bare_number (bool)
  • float_number (bool)
  • decimal_char (str)
  • group_char (str)

fields.numberField.bare_number (property)

It specifies that the value is a bare number. If true, the pattern to remove non digit character does not get applied and vice versa. The default value is True.

Signature

bool

fields.numberField.float_number (property)

It specifies that the value is a float number.

Signature

bool

fields.numberField.decimal_char (property)

It specifies the char to be used as decimal character. The default value is ".". It values can be: ".", "@" etc.

Signature

str

fields.numberField.group_char (property)

It specifies the char to be used as group character. The default value is "". It can take values such as: ",", "#" etc.

Signature

str