Helper function to determine if scalar or array value is finite extending
    np.isfinite with support for None, string, datetime types.
11926
def isfinite(val):
    
    if not np.isscalar(val):
        val = asarray(val, strict=False)

    if val is None:
        return False
    elif isinstance(val, np.ndarray):
        if val.dtype.kind == 'M':
            return ~isnat(val)
        elif val.dtype.kind == 'O':
            return np.array([isfinite(v) for v in val], dtype=bool)
        elif val.dtype.kind in 'US':
            return np.ones_like(val, dtype=bool)
        return np.isfinite(val)
    elif isinstance(val, datetime_types+timedelta_types):
        return not isnat(val)
    elif isinstance(val, basestring):
        return True
    return np.isfinite(val)
1034617
def fn_int32(self, value):
        

        if is_ndarray(value) or isinstance(value, (list, tuple)):
            return self._to_ndarray(value).astype(numpy.int32)
        else:
            return int(value)
728536
def numpy_scalar_to_python(scalar):
    
    scalar_type = type(scalar)
    if np.issubclass_(scalar_type, np.float_):
        return float(scalar)
    elif np.issubclass_(scalar_type, np.int_):
        return int(scalar)
    return scalar
899572
def _vector_or_scalar(x, type='row'):
    """"""
    if isinstance(x, (list, tuple)):
        x = np.array(x)
    if isinstance(x, np.ndarray):
        assert x.ndim == 1
        if type == 'column':
            x = x[:, None]
    return x
157929
def isin(value, values):
    
    for i, v in enumerate(value):
        if v not in np.array(values)[:, i]:
            return False
    return True
1065168
def filter_float(n: Node, query: str) -> float:
    
    return _scalariter2item(n, query, float)
874591
@Override
    public INDArray scalar(Number value, long offset) {
        if (Nd4j.dataType() == DataType.DOUBLE)
            return scalar(value.doubleValue(), offset);
        if (Nd4j.dataType() == DataType.FLOAT || Nd4j.dataType() == DataType.HALF)
            return scalar(value.floatValue(), offset);
        if (Nd4j.dataType() == DataType.INT)
            return scalar(value.intValue(), offset);
        throw new IllegalStateException("Illegal data opType " + Nd4j.dataType());
    }
528816
def is_value_type_valid_for_exact_conditions(self, value):
    
    # No need to check for bool since bool is a subclass of int
    if isinstance(value, string_types) or isinstance(value, (numbers.Integral, float)):
      return True

    return False
858327
public static boolean vIsFinite(float[] v) {
        return Float.isFinite(v[0]) && Float.isFinite(v[1]) && Float.isFinite(v[2]);
    }
190430
def contains_all(self, array):
        """"""
        dtype = getattr(array, 'dtype', None)
        if dtype is None:
            dtype = np.result_type(*array)
        return is_real_dtype(dtype)
183005
def is_finite(self):
        
        return not np.isinf(self.min) and not np.isinf(self.max)
606882
def check(self, val):
        
        # If there is no `type` requirement, everything is allowed
        if self.type is None:
            return True

        is_list = isinstance(val, list)
        # If lists are not allowed, and this is a list --> false
        if not self.listable and is_list:
            return False

        # `is_number` already checks for either list or single value
        if self.type == KEY_TYPES.NUMERIC and not is_number(val):
            return False
        elif (self.type == KEY_TYPES.TIME and
              not is_number(val) and '-' not in val and '/' not in val):
            return False
        elif self.type == KEY_TYPES.STRING:
            # If its a list, check first element
            if is_list:
                if not isinstance(val[0], basestring):
                    return False
            # Otherwise, check it
            elif not isinstance(val, basestring):
                return False
        elif self.type == KEY_TYPES.BOOL:
            if is_list and not isinstance(val[0], bool):
                return False
            elif not isinstance(val, bool):
                return False

        return True
918093
def is_finite(self):
        """"""
        return (self.num_stores == 2 and
                self.state == 0 and self.has_cell(0) and
                self.input == 1 and self.has_input(1))
669074
def _nan_minmax_object(func, fill_value, value, axis=None, **kwargs):
    
    valid_count = count(value, axis=axis)
    filled_value = fillna(value, fill_value)
    data = getattr(np, func)(filled_value, axis=axis, **kwargs)
    if not hasattr(data, 'dtype'):  # scalar case
        data = dtypes.fill_value(value.dtype) if valid_count == 0 else data
        return np.array(data, dtype=value.dtype)
    return where_method(data, valid_count != 0)
270225
def _is_valid_input(self, inpt, metadata, array):
        
        # pylint: disable=too-many-branches,no-self-use
        # Please redesign, and move to utility module
        syntax = metadata.get_syntax()

        # First check if this is a required data element
        if metadata.is_required and not inpt:
            return False

        valid = True  # Innocent until proven guilty
        # Recursively run through all the elements of an array
        if array:
            if len(inpt) < metadata.get_minimum_elements():
                valid = False
            elif len(inpt) > metadata.get_maximum_elements():
                valid = False
            else:
                for element in inpt:
                    valid = (valid and self._is_valid_input(element, metadata, False))

        # Run through all the possible syntax types
        elif syntax == 'ID':
            valid = self._is_valid_id(inpt)
        elif syntax == 'TYPE':
            valid = self._is_valid_type(inpt)
        elif syntax == 'BOOLEAN':
            valid = self._is_valid_boolean(inpt)
        elif syntax == 'STRING':
            valid = self._is_valid_string(inpt, metadata)
        elif syntax == 'INTEGER':
            valid = self._is_valid_integer(inpt, metadata)
        elif syntax == 'DECIMAL':
            valid = self._is_valid_decimal(inpt, metadata)
        elif syntax == 'DATETIME':
            valid = self._is_valid_date_time(inpt, metadata)
        elif syntax == 'DURATION':
            valid = self._is_valid_duration(inpt, metadata)
        elif syntax == 'CARDINAL':
            valid = self._is_valid_cardinal(inpt, metadata)
        elif syntax == 'INTEGER':
            valid = self._is_valid_integer(inpt, metadata)
        elif syntax == 'DECIMAL':
            valid = self._is_valid_decimal(inpt, metadata)
        else:
            raise errors.OperationFailed('no validation function available for ' + syntax)

        return valid
1311145
@Pure
	public static boolean isESRINaN(float value) {
		return Float.isInfinite(value) || Float.isNaN(value) || value <= ESRI_NAN;
	}
232384
def all_finite(self,X):
        """"""
        # Adapted from sklearn utils: _assert_all_finite(X)
        # First try an O(n) time, O(1) space solution for the common case that
        # everything is finite; fall back to O(n) space np.isfinite to prevent
        # false positives from overflow in sum method.
        # Note: this is basically here because sklearn tree.py uses float32 internally,
        # and float64's that are finite are not finite in float32.
        if (X.dtype.char in np.typecodes['AllFloat']
            and not np.isfinite(np.asarray(X,dtype='float32').sum())
            and not np.isfinite(np.asarray(X,dtype='float32')).all()):
            return False
        return True