def _set_names(self, values, level=None):
if not is_list_like(values):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if len(values) != <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>' %<EOL>len(values))<EOL><DEDENT>for name in values:<EOL><INDENT>if not is_hashable(name):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>.format(self.__class__.__name__))<EOL><DEDENT><DEDENT>self.name = values[<NUM_LIT:0>]<EOL>
Set new names on index. Each name has to be a hashable type.

Parameters
----------
values : str or sequence
    name(s) to set
level : int, level name, or sequence of int/level names (default None)
    If the index is a MultiIndex (hierarchical), level(s) to set (None
    for all levels).  Otherwise level must be None

Raises
------
TypeError if each name is not hashable.