<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replace(self, to_replace=None, value=None, inplace=False, limit=None, regex=False, method='pad', axis=None):
 """Replace values given in 'to_replace' with 'value'. Wrapper around the :meth:`pandas.DataFrame.replace` method. """

        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