@pexdoc.pcontracts.contract(rdata="<STR_LIT>", filtered="<STR_LIT>")<EOL><INDENT>def replace(self, rdata, filtered=False):<DEDENT>
<EOL>rdata_ex = pexdoc.exh.addai("<STR_LIT>")<EOL>rows_ex = pexdoc.exh.addex(<EOL>ValueError, "<STR_LIT>"<EOL>)<EOL>cols_ex = pexdoc.exh.addex(<EOL>ValueError, "<STR_LIT>"<EOL>)<EOL>rdata_ex(any([len(item) != len(rdata[<NUM_LIT:0>]) for item in rdata]))<EOL>cfilter = (<EOL>self._cfilter if filtered in [True, "<STR_LIT:B>", "<STR_LIT:b>", "<STR_LIT:C>", "<STR_LIT:c>"] else self._header<EOL>)<EOL>col_num = len(self._data[<NUM_LIT:0>]) - <NUM_LIT:1><EOL>odata = self._apply_filter(filtered)<EOL>cfilter = (<EOL>self._cfilter if filtered in [True, "<STR_LIT:B>", "<STR_LIT:b>", "<STR_LIT:C>", "<STR_LIT:c>"] else self._header<EOL>)<EOL>col_index = [<EOL>self._header_upper.index(col_id.upper())<EOL>if isinstance(col_id, str)<EOL>else col_id<EOL>for col_id in cfilter<EOL>]<EOL>rows_ex(len(odata) != len(rdata))<EOL>cols_ex(len(odata[<NUM_LIT:0>]) != len(rdata[<NUM_LIT:0>]))<EOL>df_tuples = self._format_rfilter(self._rfilter)<EOL>rnum = <NUM_LIT:0><EOL>for row in self._data:<EOL><INDENT>if (not filtered) or (<EOL>filtered<EOL>and all([row[col_num] in col_value for col_num, col_value in df_tuples])<EOL>):<EOL><INDENT>for col_num, new_data in zip(col_index, rdata[rnum]):<EOL><INDENT>row[col_num] = new_data<EOL><DEDENT>rnum = rnum + <NUM_LIT:1><EOL><DEDENT><DEDENT>
r"""
        Replace data.

        :param rdata: Replacement data
        :type  rdata: list of lists

        :param filtered: Filtering type
        :type  filtered: :ref:`CsvFiltered`

        .. [[[cog cog.out(exobj.get_sphinx_autodoc(width=63)) ]]]
        .. Auto-generated exceptions documentation for
        .. putil.pcsv.csv_file.CsvFile.replace

        :raises:
         * RuntimeError (Argument \`filtered\` is not valid)

         * RuntimeError (Argument \`rdata\` is not valid)

         * ValueError (Number of columns mismatch between input and
           replacement data)

         * ValueError (Number of rows mismatch between input and
           replacement data)

        .. [[[end]]]