return the correct fill value for the dtype of the values
170541
def _get_fill_value(dtype, fill_value=None, fill_value_typ=None):
    
    if fill_value is not None:
        return fill_value
    if _na_ok_dtype(dtype):
        if fill_value_typ is None:
            return np.nan
        else:
            if fill_value_typ == '+inf':
                return np.inf
            else:
                return -np.inf
    else:
        if fill_value_typ is None:
            return tslibs.iNaT
        else:
            if fill_value_typ == '+inf':
                # need the max int here
                return _int64_max
            else:
                return tslibs.iNaT
998991
def mean_fill(adf):
        
        ordpt = adf.values[0]
        if not pd.isnull(ordpt):
            return ordpt

        fdmn = adf.iloc[1:-1].mean()
        if not pd.isnull(fdmn):
            return fdmn

        flspt = adf.values[-1]
        if not pd.isnull(flspt):
            return flspt

        return nan
262719
def fill_zeros(result, x, y, name, fill):
    
    if fill is None or is_float_dtype(result):
        return result

    if name.startswith(('r', '__r')):
        x, y = y, x

    is_variable_type = (hasattr(y, 'dtype') or hasattr(y, 'type'))
    is_scalar_type = is_scalar(y)

    if not is_variable_type and not is_scalar_type:
        return result

    if is_scalar_type:
        y = np.array(y)

    if is_integer_dtype(y):

        if (y == 0).any():

            # GH 7325, mask and nans must be broadcastable (also: PR 9308)
            # Raveling and then reshaping makes np.putmask faster
            mask = ((y == 0) & ~np.isnan(result)).ravel()

            shape = result.shape
            result = result.astype('float64', copy=False).ravel()

            np.putmask(result, mask, fill)

            # if we have a fill of inf, then sign it correctly
            # (GH 6178 and PR 9308)
            if np.isinf(fill):
                signs = y if name.startswith(('r', '__r')) else x
                signs = np.sign(signs.astype('float', copy=False))
                negative_inf_mask = (signs.ravel() < 0) & mask
                np.putmask(result, negative_inf_mask, -fill)

            if "floordiv" in name:  # (PR 9308)
                nan_mask = ((y == 0) & (x == 0)).ravel()
                np.putmask(result, nan_mask, np.nan)

            result = result.reshape(shape)

    return result
1101735
def defaults(values={}):
    """"""
    if values: return values
    save_types = basestring, int, float, tuple, list, dict, type(None)
    for k, v in globals().items():
        if isinstance(v, save_types) and not k.startswith("_"): values[k] = v
    return values
950834
def fill_values_to_nan(masked_array):
    
    if masked_array is not None and masked_array.dtype.kind == 'f':
        check_class(masked_array, ma.masked_array)
        logger.debug("Replacing fill_values by NaNs")
        masked_array[:] = ma.filled(masked_array, np.nan)
        masked_array.set_fill_value(np.nan)
    else:
        return masked_array
1217472
def _fill(self, direction, limit=None):
        """"""
        res = super()._fill(direction, limit=limit)
        output = OrderedDict(
            (grp.name, grp.grouper) for grp in self.grouper.groupings)

        from pandas import concat
        return concat((self._wrap_transformed_output(output), res), axis=1)
265874
def strtype(self):
        """"""
        if self.kind is not None:
            return "{}({})".format(self.dtype, self.kind)
        else:
            return self.dtype
595281
def real_out_dtype(self):
        """"""
        if self.__real_out_dtype is None:
            raise AttributeError(
                'no real variant of output dtype {} defined'
                ''.format(dtype_repr(self.scalar_out_dtype)))
        else:
            return self.__real_out_dtype
557128
def get_padding_value(dtype):
  """"""
  padding_value = None
  if dtype == np.uint8:
    padding_value = np.uint8(0)
  elif dtype == np.uint16:
    padding_value = np.uint16(0)
  elif dtype == np.float32:
    padding_value = 0.0
  else:
    padding_value = 0
  assert padding_value is not None
  return padding_value
802646
def _maybe_dt_data(data, feature_names, feature_types):
    
    if not isinstance(data, DataTable):
        return data, feature_names, feature_types

    data_types_names = tuple(lt.name for lt in data.ltypes)
    bad_fields = [data.names[i]
                  for i, type_name in enumerate(data_types_names)
                  if type_name not in DT_TYPE_MAPPER]
    if bad_fields:
        msg = """DataFrame.types for data must be int, float or bool.
                Did not expect the data types in fields """
        raise ValueError(msg + ', '.join(bad_fields))

    if feature_names is None:
        feature_names = data.names

        # always return stypes for dt ingestion
        if feature_types is not None:
            raise ValueError('DataTable has own feature types, cannot pass them in')
        feature_types = np.vectorize(DT_TYPE_MAPPER2.get)(data_types_names)

    return data, feature_names, feature_types
60052
def _create_column(values, dtype):
    ""
    if str(dtype) == "tensor(int64)":
        return numpy.array(values, dtype=numpy.int64)
    elif str(dtype) == "tensor(float)":
        return numpy.array(values, dtype=numpy.float32)
    else:
        raise OnnxRuntimeAssertionError("Unable to create one column from dtype '{0}'".format(dtype))
1015651
def _fill(self, values):
        """"""
        zero = self.view.y(min(max(self.zero, self._box.ymin), self._box.ymax))

        # Check to see if the data has been padded with "none's"
        # Fill doesn't work correctly otherwise
        end = len(values) - 1
        while end > 0:
            x, y = values[end]
            if self.missing_value_fill_truncation == "either":
                if x is not None and y is not None:
                    break
            elif self.missing_value_fill_truncation == "x":
                if x is not None:
                    break
            elif self.missing_value_fill_truncation == "y":
                if y is not None:
                    break
            else:
                raise ValueError(
                    "Invalid value ({}) for config key "
                    "'missing_value_fill_truncation';"
                    " Use 'x', 'y' or 'either'".format(
                        self.missing_value_fill_truncation
                    )
                )
            end -= 1

        return ([(values[0][0], zero)] + values + [(values[end][0], zero)])
382936
def _check_dtype(self, dtype):
        """"""
        try:
            return _ffi_types[dtype]
        except KeyError:
            raise ValueError("dtype must be one of {0!r} and not {1!r}".format(
                sorted(_ffi_types.keys()), dtype))
812255
def ensure_dtype(core, dtype, dtype_):
    """"""
    core = core.copy()
    if dtype is None:
        dtype = dtype_

    if dtype_ == dtype:
        return core, dtype

    for key, val in {
            int: chaospy.poly.typing.asint,
            float: chaospy.poly.typing.asfloat,
            np.float32: chaospy.poly.typing.asfloat,
            np.float64: chaospy.poly.typing.asfloat,
    }.items():

        if dtype == key:
            converter = val
            break
    else:
        raise ValueError("dtype not recognised (%s)" % str(dtype))

    for key, val in core.items():
        core[key] = converter(val)
    return core, dtype
24452
def t(self, value):
        """"""
        assert (isinstance(value, scipy.ndarray) and (value.dtype ==
                'float') and (value.shape == self.t.shape))
        if (self._t != value).any():
            self._t = value.copy()
            self._updateInternals()
25425
def _dtype_array(self):
        """"""
        attrtype = []
        attrdiff = []

        for key in self._headers:
            if self.attr[key][0] == 'continuous':
                attrtype.append(1)
            else:
                attrtype.append(0)
            attrdiff.append(self.attr[key][3])

        attrtype = np.array(attrtype)
        cidx = np.where(attrtype == 1)[0]
        didx = np.where(attrtype == 0)[0]

        attrdiff = np.array(attrdiff)

        return attrdiff, cidx, didx
287852
def convert_numpy_type(cls, dtype):
        

        m = {
            'int64': cls.DATATYPE_INTEGER64,
            'float64': cls.DATATYPE_FLOAT,
            'object': cls.DATATYPE_TEXT  # Hack. Pandas makes strings into object.
        }

        t = m.get(dtype.name, None)

        if not t:
            raise TypeError(
                "Failed to convert numpy type: '{}' ".format(
                    dtype.name))

        return t