gluonts.transform.field module#

class gluonts.transform.field.RemoveFields(field_names: List[str])[source]#

Bases: gluonts.transform._base.SimpleTransformation

Remove field names if present.

Parameters

field_names – List of names of the fields that will be removed

transform(data: Dict[str, Any]) Dict[str, Any][source]#
class gluonts.transform.field.RenameFields(mapping: Dict[str, str])[source]#

Bases: gluonts.transform._base.SimpleTransformation

Rename fields using a mapping, if source field present.

Parameters

mapping – Name mapping input_name -> output_name

transform(data: Dict[str, Any])[source]#
class gluonts.transform.field.SelectFields(input_fields: List[str], allow_missing: bool = False)[source]#

Bases: gluonts.transform._base.MapTransformation

Only keep the listed fields.

Parameters
  • input_fields – List of fields to keep.

  • allow_missing – If True, skip any missing field. Default: False.

map_transform(data: Dict[str, Any], is_train: bool) Dict[str, Any][source]#
class gluonts.transform.field.SetField(output_field: str, value: Any)[source]#

Bases: gluonts.transform._base.SimpleTransformation

Sets a field in the dictionary with the given value.

Parameters
  • output_field – Name of the field that will be set

  • value – Value to be set

transform(data: Dict[str, Any]) Dict[str, Any][source]#
class gluonts.transform.field.SetFieldIfNotPresent(field: str, value: Any)[source]#

Bases: gluonts.transform._base.SimpleTransformation

Sets a field in the dictionary with the given value, in case it does not exist already.

Parameters
  • output_field – Name of the field that will be set

  • value – Value to be set

transform(data: Dict[str, Any]) Dict[str, Any][source]#