# Buggy code
def droplevel(self, level=0):
    """
    Return index with requested level(s) removed.

    If resulting index has only 1 level left, the result will be
    of Index type, not MultiIndex.

    .. versionadded:: 0.23.1 (support for non-MultiIndex)

    Parameters
    ----------
    level : int, str, or list-like, default 0
        If a string is given, must be the name of a level
        If list-like, elements must be names or indexes of levels.

    Returns
    -------
    Index or MultiIndex
    """
    if not isinstance(level, (tuple, list)):
        level = [level]

    levnums = sorted(self._get_level_number(lev) for lev in level)[::-1]

    if len(level) == 0:
        return self
    if len(level) >= self.nlevels:
        raise ValueError(
            f"Cannot remove {len(level)} levels from an index with {self.nlevels} "
            "levels: at least one level must be left."
        )
    # The two checks above guarantee that here self is a MultiIndex

    new_levels = list(self.levels)
    new_codes = list(self.codes)
    new_names = list(self.names)

    for i in levnums:
        new_levels.pop(i)
        new_codes.pop(i)
        new_names.pop(i)

    if len(new_levels) == 1:
        # set nan if needed
        mask = new_codes[0] == -1
        result = new_levels[0].take(new_codes[0])
        if mask.any():
            result = result.putmask(mask, np.nan)

        result.name = new_names[0]
        return result
    else:
        from .multi import MultiIndex

        return MultiIndex(
            levels=new_levels,
            codes=new_codes,
            names=new_names,
            verify_integrity=False,
        )


# Traceback (TypeError)
In [5]: pd.Series([], name=[])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-2c73ddde103e> in <module>
----> 1 pd.Series([], name=[])

~/sandbox/pandas/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
326         generic.NDFrame.__init__(self, data, fastpath=True)
327
--> 328         self.name = name
329         self._set_axis(0, index, fastpath=True)
330

~/sandbox/pandas/pandas/core/generic.py in __setattr__(self, name, value)
5257             object.__setattr__(self, name, value)
5258         elif name in self._metadata:
-> 5259             object.__setattr__(self, name, value)
5260         else:
5261             try:

~/sandbox/pandas/pandas/core/series.py in name(self, value)
468     def name(self, value):
469         if value is not None and not is_hashable(value):
--> 470             raise TypeError("Series.name must be a hashable type")
471         object.__setattr__(self, "_name", value)
472

TypeError: Series.name must be a hashable type

# Fixed code
def droplevel(self, level=0):
    """
    Return index with requested level(s) removed.

    If resulting index has only 1 level left, the result will be
    of Index type, not MultiIndex.

    .. versionadded:: 0.23.1 (support for non-MultiIndex)

    Parameters
    ----------
    level : int, str, or list-like, default 0
        If a string is given, must be the name of a level
        If list-like, elements must be names or indexes of levels.

    Returns
    -------
    Index or MultiIndex
    """
    if not isinstance(level, (tuple, list)):
        level = [level]

    levnums = sorted(self._get_level_number(lev) for lev in level)[::-1]

    if len(level) == 0:
        return self
    if len(level) >= self.nlevels:
        raise ValueError(
            f"Cannot remove {len(level)} levels from an index with {self.nlevels} "
            "levels: at least one level must be left."
        )
    # The two checks above guarantee that here self is a MultiIndex

    new_levels = list(self.levels)
    new_codes = list(self.codes)
    new_names = list(self.names)

    for i in levnums:
        new_levels.pop(i)
        new_codes.pop(i)
        new_names.pop(i)

    if len(new_levels) == 1:
        # set nan if needed
        mask = new_codes[0] == -1
        result = new_levels[0].take(new_codes[0])
        if mask.any():
            result = result.putmask(mask, np.nan)

        result._name = new_names[0]
        return result
    else:
        from .multi import MultiIndex

        return MultiIndex(
            levels=new_levels,
            codes=new_codes,
            names=new_names,
            verify_integrity=False,
        )