DiscreteVariable.posLabel
- DiscreteVariable.posLabel(s)
Returns the index of the label
sin the variable’s domain (if the variable is apyagrum.LabelizedVariable)- Raises:
NotImplementedError – If the variable is not a
pyagrum.LabelizedVariableNotFoundError – If the variable does not contain the label
s
- Return type:
int- Returns:
- int
the index of the label
sin the variable’s domain
- Parameters:
s (
str)
Example
import pyagrum as gum
v = gum.fastVariable("c{red|green|blue}") # a LabelizedVariable
v.posLabel("green")
# 1
Used by
DiscreteVariable, DiscretizedVariable, IntegerVariable, NumericalDiscreteVariable, RangeVariable

Overridden in