ValueChange(old_value, new_value)
Source¶
One old value of an Array and the new value replacing it, used by ValueMapping.
Added in version 0.1.0
Parameters:
-
old_value(ScalarValue)The value replaced, of the type family of the Array:
2.0finds the integer2. -
new_value(ScalarValue | None)The value replacing it, or None to make it missing.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names, such as None as old value.
Examples:
import numdaplot as ndp
severities = ndp.Array.from_list([1, 2, -1])
changes = [ndp.ValueChange(1, "Indemne"), ndp.ValueChange(2, "Tue"), ndp.ValueChange(-1, None)]
severities.apply(ndp.ValueMapping(changes=changes))
# Array(['Indemne', 'Tue', nan], dtype=TEXT)