

def set_names(self, names, level=None, inplace=False):
    "\n        Set new names on index. Defaults to returning new index.\n\n        Parameters\n        ----------\n        names : str or sequence\n            name(s) to set\n        level : int, level name, or sequence of int/level names (default None)\n            If the index is a MultiIndex (hierarchical), level(s) to set (None\n            for all levels).  Otherwise level must be None\n        inplace : bool\n            if True, mutates in place\n\n        Returns\n        -------\n        new index (of same type and class...etc) [if inplace, returns None]\n\n        Examples\n        --------\n        >>> Index([1, 2, 3, 4]).set_names('foo')\n        Int64Index([1, 2, 3, 4], dtype='int64')\n        >>> Index([1, 2, 3, 4]).set_names(['foo'])\n        Int64Index([1, 2, 3, 4], dtype='int64')\n        >>> idx = MultiIndex.from_tuples([(1, u'one'), (1, u'two'),\n                                          (2, u'one'), (2, u'two')],\n                                          names=['foo', 'bar'])\n        >>> idx.set_names(['baz', 'quz'])\n        MultiIndex(levels=[[1, 2], [u'one', u'two']],\n                   labels=[[0, 0, 1, 1], [0, 1, 0, 1]],\n                   names=[u'baz', u'quz'])\n        >>> idx.set_names('baz', level=0)\n        MultiIndex(levels=[[1, 2], [u'one', u'two']],\n                   labels=[[0, 0, 1, 1], [0, 1, 0, 1]],\n                   names=[u'baz', u'bar'])\n        "
    if ((level is not None) and (self.nlevels == 1)):
        raise ValueError('Level must be None for non-MultiIndex')
    if ((level is not None) and (not is_list_like(names)) and is_list_like(names)):
        raise TypeError('Names must be a string')
    if ((not is_list_like(names)) and (level is None) and (self.nlevels > 1)):
        raise TypeError('Must pass list-like as `names`.')
    if (not is_list_like(names)):
        names = [names]
    if ((level is not None) and (not is_list_like(level))):
        level = [level]
    if inplace:
        idx = self
    else:
        idx = self._shallow_copy()
    idx._set_names(names, level=level)
    if (not inplace):
        return idx

dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py Index.set_names/VarMisuse@62/648 `level`->`names`