def reindex(self, target, method=None, level=None, limit=None,<EOL>tolerance=None):
<EOL>preserve_names = not hasattr(target, '<STR_LIT:name>')<EOL>target = _ensure_has_len(target)  <EOL>if not isinstance(target, Index) and len(target) == <NUM_LIT:0>:<EOL><INDENT>attrs = self._get_attributes_dict()<EOL>attrs.pop('<STR_LIT>', None)  <EOL>values = self._data[:<NUM_LIT:0>]  <EOL>target = self._simple_new(values, dtype=self.dtype, **attrs)<EOL><DEDENT>else:<EOL><INDENT>target = ensure_index(target)<EOL><DEDENT>if level is not None:<EOL><INDENT>if method is not None:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>_, indexer, _ = self._join_level(target, level, how='<STR_LIT:right>',<EOL>return_indexers=True)<EOL><DEDENT>else:<EOL><INDENT>if self.equals(target):<EOL><INDENT>indexer = None<EOL><DEDENT>else:<EOL><INDENT>if self.is_unique:<EOL><INDENT>indexer = self.get_indexer(target, method=method,<EOL>limit=limit,<EOL>tolerance=tolerance)<EOL><DEDENT>else:<EOL><INDENT>if method is not None or limit is not None:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>indexer, missing = self.get_indexer_non_unique(target)<EOL><DEDENT><DEDENT><DEDENT>if preserve_names and target.nlevels == <NUM_LIT:1> and target.name != self.name:<EOL><INDENT>target = target.copy()<EOL>target.name = self.name<EOL><DEDENT>return target, indexer<EOL>
Create index with target's values (move/add/delete values
as necessary).

Parameters
----------
target : an iterable

Returns
-------
new_index : pd.Index
    Resulting index.
indexer : np.ndarray or None
    Indices of output values in original index.