

@Appender(_index_shared_docs['copy'])
def copy(self, name=None, deep=False, dtype=None, **kwargs):
    names = kwargs.get('names')
    if ((names is not None) and (name is not None)):
        raise TypeError('Can only provide one of `names` and `name`')
    if deep:
        from copy import deepcopy
        new_index = self._shallow_copy(self._data.copy())
        name = (name or deepcopy(self.name))
    else:
        new_index = self._shallow_copy()
        name = self.name
    if (name is not None):
        names = [name]
    if names:
        new_index = new_index.set_names(names)
    if dtype:
        new_index = new_index.astype(dtype)
    return new_index

dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py Index.copy/original