(self, s)
return self._value_index[s]
Convert the given argument to a value of the variable (`float`).
        If the argument is numeric, its value is returned without checking
        whether it is integer and within bounds. `Unknown` is returned if the
        argument is one of the representations for unknown values. Otherwise,
        the argument must be a string and the method returns its index in
        :obj:`values`.

        :param s: values, represented as a number, string or `None`
        :rtype: float
Convert the given argument to a value of the variable (`float`).
        If the argument is numeric, its value is returned without checking
        whether it is integer and within bounds. `Unknown` is returned if the
        argument is one of the representations for unknown values. Otherwise,
        the argument must be a string and the method returns its index in
        :obj:`values`.
Convert the given argument to a value of the variable ( float ) . If the argument is numeric its value is returned without checking whether it is integer and within bounds . Unknown is returned if the argument is one of the representations for unknown values . Otherwise the argument must be a string and the method returns its index in : obj : values .
def to_val(self, s):
        """
        Convert the given argument to a value of the variable (`float`).
        If the argument is numeric, its value is returned without checking
        whether it is integer and within bounds. `Unknown` is returned if the
        argument is one of the representations for unknown values. Otherwise,
        the argument must be a string and the method returns its index in
        :obj:`values`.

        :param s: values, represented as a number, string or `None`
        :rtype: float
        """
        if s is None:
            return ValueUnknown

        if isinstance(s, Integral):
            return s
        if isinstance(s, Real):
            return s if isnan(s) else floor(s + 0.25)
        if s in self.unknown_str:
            return ValueUnknown
        if not isinstance(s, str):
            raise TypeError('Cannot convert {} to value of "{}"'.format(
                type(s).__name__, self.name))
        if s not in self._value_index:
            raise ValueError(f"Value {s} does not exist")
        return self._value_index[s]
def to_val ( self , s ) : if s is None : return ValueUnknown if isinstance ( s , Integral ) : return s if isinstance ( s , Real ) : return s if isnan ( s ) else floor ( s + 0.25 ) if s in self . unknown_str : return ValueUnknown if not isinstance ( s , str ) : raise TypeError ( 'Cannot convert {} to value of "{}"' . format ( type ( s ) . __name__ , self . name ) ) if s not in self . _value_index : raise ValueError ( f"Value {s} does not exist" ) return self . _value_index [ s ]