eogrow.utils.zipmap
A collection of functions to be used with the ZipMapPipeline.
- pydantic model eogrow.utils.zipmap.MapParams[source]
Bases:
Schema
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- field default: int | None = None
- field dtype: dtype [Required]
- Validated by:
optional_parse_dtype
- field mapping: Dict[int, int] [Required]
- eogrow.utils.zipmap.map_values(array, *, mapping, default=None, dtype=None)[source]
Maps all values from array according to a dictionary. A default value can be given, which is assigned to values without a corresponding key in the mapping dictionary.
Vectorizing the .get method is faster, but difficult to do with a default (and also loses speed advantage).
- Parameters:
array (ndarray) –
mapping (dict[int, int]) –
default (int | None) –
dtype (dtype | None) –
- Return type:
ndarray