Categorical.from_codes(codes, categories, ordered=False, name=None)
The parameter for categories is documented as being `index-like`.  

Does that include dictionaries?

If so, some unexpected results occurred when working with integers and dictionaries in version 0.17.1

The following sets out what I found

``` python
sex = [1,2,0,1]
categories = {1:'Male', 2:'Female', 0:'Unknown'}

pd.Categorical.from_codes(sex, categories=categories)
```

returns the the array with keys instead of the values  (though i suspect that was luck given outcomes below)

```
[1, 2, 0, 1]
Categories (3, int64): [0, 1, 2]
```

Swapping the dictionary key/values around shows doesn't match values to keys though:

```
sex = [1,2,0,1]
categories = {'Male':1, 'Female':2, 'Unknown':0}

pd.Categorical.from_codes(sex, categories=categories)
```

returns an array that has incorrectly mapped codes and categories

```
[Unknown, Male, Female, Unknown]
Categories (3, object): [Female, Unknown, Male]
```

Using a non-sequential numerical ordering for the codes fails with a dictionary

``` python
sex = [1,2,9,1]
categories = {'Male':1, 'Female':2, 'Unknown':9}

pd.Categorical.from_codes(sex, categories=categories)
```

Fails with `ValueError: codes need to be between -1 and len(categories)-1`

at line 386 in categorical.py at `if len(codes) and (codes.max() >= len(categories) or codes.min() < -1)`

presumably because the second logical element.   

I'm guessing it's meant to be a cheque on the count of the number of unique elements in `codes` being greater than or equal to the number of items in `categories`.
