def _single_replace(self, to_replace, method, inplace, limit):
if self.ndim != <NUM_LIT:1>:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>.format(to_replace, method, type(self).__name__))<EOL><DEDENT>orig_dtype = self.dtype<EOL>result = self if inplace else self.copy()<EOL>fill_f = missing.get_fill_func(method)<EOL>mask = missing.mask_missing(result.values, to_replace)<EOL>values = fill_f(result.values, limit=limit, mask=mask)<EOL>if values.dtype == orig_dtype and inplace:<EOL><INDENT>return<EOL><DEDENT>result = pd.Series(values, index=self.index,<EOL>dtype=self.dtype).__finalize__(self)<EOL>if inplace:<EOL><INDENT>self._update_inplace(result._data)<EOL>return<EOL><DEDENT>return result<EOL>
Replaces values in a Series using the fill method specified when no
replacement value is given in the replace method