pydata/pandas — pull request #7892 by immerrr (2014-07-31 20:01:01+00:00)
Title: API: add 'level' kwarg to 'Index.isin' method

closes #7890

This PR adds `level` kwarg for `Index` objects as discussed (briefly in #7890):

```python

Index.isin(iterable, level=None)
```

### Summary
- for non-`MultiIndex` classes:
- no functional changes in the actual membership test
- valid `level` values are `None`, `0`, `-1` and `self.name`
- if `level` doesn't match the name, it's a `KeyError` (was `AssertionError` before)
- for `MultiIndex` classes:
- if `level=None`, elements of `self.values` (tuples) are used
- otherwise elements of corresponding level are used
- valid `level` values are the same as in `MultiIndex.get_level_values` method, `-self.nlevels..(self.nlevels - 1)` plus all unique index names

### TODO
- [ ] add to documentation
- [ ] optimize MultiIndex case