parameters: (self, to_replace, method, inplace, limit)
return_statement: return result
docstring: Replaces values in a Series using the fill method specified when no
      replacement value is given in the replace method
docstring_summary: Replaces values in a Series using the fill method specified when no
      replacement value is given in the replace method
docstring_tokens: Replaces values in a Series using the fill method specified when no replacement value is given in the replace method
function: def _single_replace(self, to_replace, method, inplace, limit):
      """
      Replaces values in a Series using the fill method specified when no
      replacement value is given in the replace method
      """
      if self.ndim != 1:
          raise TypeError(
              f"cannot replace {to_replace} with method {method} on a "
              f"{type(self).__name__}"
          )
  
      orig_dtype = self.dtype
      result = self if inplace else self.copy()
      fill_f = missing.get_fill_func(method)
  
      mask = missing.mask_missing(result.values, to_replace)
      values = fill_f(result.values, limit=limit, mask=mask)
  
      if values.dtype == orig_dtype and inplace:
          return
  
      result = pd.Series(values, index=self.index, dtype=self.dtype).__finalize__(self)
  
      if inplace:
          self._update_inplace(result._data)
          return
  
      return result
function_tokens: def _single_replace ( self , to_replace , method , inplace , limit ) : if self . ndim != 1 : raise TypeError ( f"cannot replace {to_replace} with method {method} on a " f"{type(self).__name__}" ) orig_dtype = self . dtype result = self if inplace else self . copy ( ) fill_f = missing . get_fill_func ( method ) mask = missing . mask_missing ( result . values , to_replace ) values = fill_f ( result . values , limit = limit , mask = mask ) if values . dtype == orig_dtype and inplace : return result = pd . Series ( values , index = self . index , dtype = self . dtype ) . __finalize__ ( self ) if inplace : self . _update_inplace ( result . _data ) return return result