Replace values given in 'to_replace' with 'value'.

        Wrapper around the :meth:`pandas.DataFrame.replace` method.
519708
def replace(self, to_replace=None, value=None, inplace=False,
                limit=None, regex=False, method='pad', axis=None):
        
        if inplace:
            self._frame.replace(to_replace=to_replace, value=value,
                                inplace=inplace, limit=limit, regex=regex,
                                method=method, axis=axis)
        else:
            new = self.__class__(self._frame.replace(
                to_replace=to_replace, value=value, inplace=inplace,
                limit=limit, regex=regex, method=method, axis=axis))
            new.metadata = self.metadata.copy()
            new._metadata = copy.deepcopy(self._metadata)
            return new
1294958
def _replace(self, feature, cursor):
        
        try:
            cursor.execute(
                constants._UPDATE,
                list(feature.astuple()) + [feature.id])
        except sqlite3.ProgrammingError:
            cursor.execute(
                constants._INSERT,
                list(feature.astuple(self.default_encoding)) + [feature.id])
278239
def substitute(ctx, text, old_text, new_text, instance_num=-1):
    
    text = conversions.to_string(text, ctx)
    old_text = conversions.to_string(old_text, ctx)
    new_text = conversions.to_string(new_text, ctx)

    if instance_num < 0:
        return text.replace(old_text, new_text)
    else:
        splits = text.split(old_text)
        output = splits[0]
        instance = 1
        for split in splits[1:]:
            sep = new_text if instance == instance_num else old_text
            output += sep + split
            instance += 1
        return output
883325
def _replace_missing_values_table(values, mv):
    

    for idx, column in enumerate(values):
        values[idx] = _replace_missing_values_column(column, mv)

    return values
399936
def convert(self, values, nan_rep, encoding, errors):
        

        self.values = Int64Index(np.arange(self.table.nrows))
        return self
1351507
def replace_zeros(self, val, zero_thresh=0.0):
        
        new_data = self.data.copy()
        new_data[new_data <= zero_thresh] = val
        return type(self)(new_data.astype(self.data.dtype), frame=self._frame)
641247
def replace_nones(dict_or_list):
    """"""

    def replace_none_in_value(value):
        if isinstance(value, basestring) and value.lower() == "none":
            return None
        return value

    items = dict_or_list.iteritems() if isinstance(dict_or_list, dict) else enumerate(dict_or_list)

    for accessor, value in items:
        if isinstance(value, (dict, list)):
            replace_nones(value)
        else:
            dict_or_list[accessor] = replace_none_in_value(value)
498783
def substitute_vars(template, replacements):
    
    result = template
    for (key, value) in replacements:
        result = result.replace('${' + key + '}' , value)
    if '${' in result:
        logging.warning("A variable was not replaced in '%s'.", result)
    return result
1256861
def replace_header(self, name, value):
        
        name_lower = name.lower()
        for index in range(len(self.headers) - 1, -1, -1):
            curr_name, curr_value = self.headers[index]
            if curr_name.lower() == name_lower:
                self.headers[index] = (curr_name, value)
                return curr_value

        self.headers.append((name, value))
        return None
850037
function applyReplacements(str, replacements) {
    var result = "",
        replacement,
        i;

    for (i = 0; i < replacements.length; i++) {
        replacement = replacements[i];
        if (replacement) {
            result += replacement.newStr;
            i += replacement.oldStr.length - 1;
        } else {
            result += str.charAt(i);
        }
    }

    result += str.substr(i, str.length);

    return result;
}
892165
def convert_values(self, matchdict: Dict[str, str]) -> Dict[str, Any]:
        

        converted = {}
        for varname, value in matchdict.items():
            converter = self.converters[varname]
            converted[varname] = converter(value)
        return converted
9324
function replace(searchValue, replaceValue) {
      var O = defined(this);
      var fn = searchValue == undefined ? undefined : searchValue[REPLACE];
      return fn !== undefined
        ? fn.call(searchValue, O, replaceValue)
        : $replace.call(String(O), searchValue, replaceValue);
    }
1244789
def replace_expression(self, expr, replacement):
        

        for k in self.__slots__:
            v = getattr(self, k)
            if v is expr:
                setattr(self, k, replacement)
            elif type(v) is list:
                # Replace the instance in the list
                for i, expr_ in enumerate(v):
                    if expr_ is expr:
                        v[i] = replacement
            elif type(v) is tuple:
                # Rebuild the tuple
                _lst = [ ]
                replaced = False
                for i, expr_ in enumerate(v):
                    if expr_ is expr:
                        _lst.append(replacement)
                        replaced = True
                    else:
                        _lst.append(expr_)
                if replaced:
                    setattr(self, k, tuple(_lst))
            elif isinstance(v, IRExpr):
                v.replace_expression(expr, replacement)
1197986
def replaceMaskedValueWithNan(self):
        
        kind = self.data.dtype.kind
        if kind == 'i' or kind == 'u': # signed/unsigned int
            self.data = self.data.astype(np.float, casting='safe')

        if self.data.dtype.kind != 'f':
            return # only replace for floats

        if self.mask is False:
            pass
        elif self.mask is True:
            self.data[:] = np.NaN
        else:
            self.data[self.mask] = np.NaN
1183729
def config_replace(self, *args, **kwargs):
        
        return self._client.request('/config/replace', args,
                                    decoder='json', **kwargs)
1177393
def replace(self, to_replace, value, inplace=False, filter=None,
                regex=False, convert=True):
        

        inplace = validate_bool_kwarg(inplace, 'inplace')
        original_to_replace = to_replace

        # try to replace, if we raise an error, convert to ObjectBlock and
        # retry
        try:
            values, to_replace = self._try_coerce_args(self.values,
                                                       to_replace)
            mask = missing.mask_missing(values, to_replace)
            if filter is not None:
                filtered_out = ~self.mgr_locs.isin(filter)
                mask[filtered_out.nonzero()[0]] = False

            blocks = self.putmask(mask, value, inplace=inplace)
            if convert:
                blocks = [b.convert(by_item=True, numeric=False,
                                    copy=not inplace) for b in blocks]
            return blocks
        except (TypeError, ValueError):
            # GH 22083, TypeError or ValueError occurred within error handling
            # causes infinite loop. Cast and retry only if not objectblock.
            if is_object_dtype(self):
                raise

            # try again with a compatible block
            block = self.astype(object)
            return block.replace(to_replace=original_to_replace,
                                 value=value,
                                 inplace=inplace,
                                 filter=filter,
                                 regex=regex,
                                 convert=convert)
1296848
public void replace(int index, Object value) {
    values.set(index, value);
    this.path = null; // path is no longer valid if values are replaced
  }