ValuePostprocessor
Bases: GeodataPostprocessor
Geodata postprocessor that maps the values of a field
Examples:
Assume the geodataframe has the values 0, 1 and 2 in the field 'class'.
You can map the values 0, 1 and 2 to 'class_1', 'class_2' and 'class_3'.
>>> value_postprocessor = ValuePostprocessor(
... mapping={
... 0: 'class_1',
... 1: 'class_2',
... 2: 'class_3',
... },
... field_name='class',
... )
...
>>> gdf = value_postprocessor(gdf)
PARAMETER | DESCRIPTION |
---|---|
mapping
|
mapping of the values (old value: new value)
TYPE:
|
field_name
|
name of the field
TYPE:
|
from_config
classmethod
Creates a value postprocessor from the configuration.
PARAMETER | DESCRIPTION |
---|---|
config
|
configuration
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ValuePostprocessor
|
value postprocessor |
__call__
Postprocesses the geodata by mapping the values of a field.
PARAMETER | DESCRIPTION |
---|---|
gdf
|
geodataframe
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
gpd.GeoDataFrame
|
postprocessed geodataframe |
ValuePostprocessorConfig
Bases: pydantic.BaseModel
Configuration for the from_config
class method of ValuePostprocessor
ATTRIBUTE | DESCRIPTION |
---|---|
mapping |
mapping of the values (old value: new value)
TYPE:
|
field_name |
name of the field
TYPE:
|