# Buggy code
def _convert_to_indexer(self, obj, axis=0):
    """
    Convert indexing key into something we can use to do actual fancy
    indexing on an ndarray

    Examples
    ix[:5] -> slice(0, 5)
    ix[[1,2,3]] -> [1,2,3]
    ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz)

    Going by Zen of Python?
    "In the face of ambiguity, refuse the temptation to guess."
    raise AmbiguousIndexError with integer labels?
    - No, prefer label-based indexing
    """
    labels = self.obj._get_axis(axis)

    try:
        return labels.get_loc(obj)
    except (KeyError, TypeError):
        pass

    is_int_index = _is_integer_index(labels)
    if isinstance(obj, slice):
        int_slice = _is_index_slice(obj)
        null_slice = obj.start is None and obj.stop is None
        # could have integers in the first level of the MultiIndex
        position_slice = (
            int_slice
            and not labels.inferred_type == "integer"
            and not isinstance(labels, MultiIndex)
        )

        if null_slice or position_slice:
            slicer = obj
        else:
            try:
                i, j = labels.slice_locs(obj.start, obj.stop)
                slicer = slice(i, j, obj.step)
            except Exception:
                if _is_index_slice(obj):
                    if labels.inferred_type == "integer":
                        raise
                    slicer = obj
                else:
                    raise

        return slicer

    elif _is_list_like(obj):
        if com._is_bool_indexer(obj):
            objarr = _check_bool_indexer(labels, obj)
            return objarr
        else:
            objarr = _asarray_tuplesafe(obj)

            # If have integer labels, defer to label-based indexing
            if _is_integer_dtype(objarr) and not is_int_index:
                return objarr

            indexer = labels.get_indexer(objarr)
            mask = indexer == -1
            if mask.any():
                raise KeyError("%s not in index" % objarr[mask])

            return indexer
    else:
        if com.is_integer(obj) and not is_int_index:
            return obj
        return labels.get_loc(obj)


# Traceback (TypeError)
In [20]: df
Out[20]:
value
id
t1 a   1
b   2
c   3
t2 a   7
b   8

In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
----> 1 df.ix[:, 'value']

/home/wesm/code/pandas/pandas/core/indexing.pyc in __getitem__(self, key)
28                 pass
29
---> 30             return self._getitem_tuple(key)
31         else:
32             return self._getitem_axis(key, axis=0)

/home/wesm/code/pandas/pandas/core/indexing.pyc in _getitem_tuple(self, tup)
97     def _getitem_tuple(self, tup):
98         try:
---> 99             return self._getitem_lowerdim(tup)
100         except IndexingError:
101             pass

/home/wesm/code/pandas/pandas/core/indexing.pyc in _getitem_lowerdim(self, tup)
126                 pass
127             except Exception:
--> 128                 if tup[0] not in ax0:
129                     raise
130

/home/wesm/code/pandas/pandas/core/index.pyc in __contains__(self, key)
209
210     def __contains__(self, key):
--> 211         return key in self._engine
212
213     def __hash__(self):

/home/wesm/code/pandas/pandas/_engines.so in pandas._engines.DictIndexEngine.__contains__ (pandas/src/engines.c:1958)()

TypeError: unhashable type

# Fixed code
def _convert_to_indexer(self, obj, axis=0):
    """
    Convert indexing key into something we can use to do actual fancy
    indexing on an ndarray

    Examples
    ix[:5] -> slice(0, 5)
    ix[[1,2,3]] -> [1,2,3]
    ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz)

    Going by Zen of Python?
    "In the face of ambiguity, refuse the temptation to guess."
    raise AmbiguousIndexError with integer labels?
    - No, prefer label-based indexing
    """
    labels = self.obj._get_axis(axis)
    is_int_index = _is_integer_index(labels)

    if com.is_integer(obj) and not is_int_index:
        return obj

    try:
        return labels.get_loc(obj)
    except (KeyError, TypeError):
        pass

    if isinstance(obj, slice):
        int_slice = _is_index_slice(obj)
        null_slice = obj.start is None and obj.stop is None
        # could have integers in the first level of the MultiIndex
        position_slice = (
            int_slice
            and not labels.inferred_type == "integer"
            and not isinstance(labels, MultiIndex)
        )

        if null_slice or position_slice:
            slicer = obj
        else:
            try:
                i, j = labels.slice_locs(obj.start, obj.stop)
                slicer = slice(i, j, obj.step)
            except Exception:
                if _is_index_slice(obj):
                    if labels.inferred_type == "integer":
                        raise
                    slicer = obj
                else:
                    raise

        return slicer

    elif _is_list_like(obj):
        if com._is_bool_indexer(obj):
            objarr = _check_bool_indexer(labels, obj)
            return objarr
        else:
            objarr = _asarray_tuplesafe(obj)

            # If have integer labels, defer to label-based indexing
            if _is_integer_dtype(objarr) and not is_int_index:
                return objarr

            indexer = labels.get_indexer(objarr)
            mask = indexer == -1
            if mask.any():
                raise KeyError("%s not in index" % objarr[mask])

            return indexer
    else:
        return labels.get_loc(obj)