

def _shallow_copy_with_infer(self, values=None, **kwargs):
    "\n        create a new Index inferring the class with passed value, don't copy\n        the data, use the same object attributes with passed in attributes\n        taking precedence\n\n        *this is an internal non-public method*\n\n        Parameters\n        ----------\n        values : the values to create the new Index, optional\n        kwargs : updates the default attributes for this Index\n        "
    if (values is None):
        values = self.values
    attributes = self._get_attributes_dict()
    attributes.update(kwargs)
    attributes['copy'] = False
    if self._infer_as_myclass:
        try:
            return self._constructor(values, **attributes)
        except (TypeError, ValueError):
            pass
    return Index(values, **attributes)

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