Issue 1:
Code Sample, a copy-pastable example if possible

import pandas as pd

unames = ['user_id','gender','age','occupation','zip']

users = pd.read_table('D:/ProgramData/movielens/users.dat',sep='::', header=None, names=unames)

rnames = ['user_id','movie_id','rating','timestamp']

ratings = pd.read_table('D:/ProgramData/movielens/ratings.dat',sep='::', header=None, names=rnames)

mnames = ['movie_id','title','genres']

movies = pd.read_table('D:/ProgramData/movielens/movies.dat',sep='::', header=None, names=mnames)

data = pd.merge(pd.merge(ratings,users),movies)

mean_ratings = data.pivot_table(['rating'], index=['title'], columns='gender', aggfunc='mean')

ratings_by_title = data.groupby('title').size()

active_titles = ratings_by_title.index[ratings_by_title >= 250]

mean_ratings = mean_ratings.ix[active_titles]

top_female_ratings = mean_ratings.sort_index(by='F', ascending=False)

print top_female_ratings[:10]

#### Problem description

In[54]: mean_ratings[:5]
Out[54]:
rating
gender F M
title
$1,000,000 Duck (1971) 3.375000 2.761905
'Night Mother (1986) 3.388889 3.352941
'Til There Was You (1997) 2.675676 2.733333
'burbs, The (1989) 2.793478 2.962085
...And Justice for All (1979) 3.828571 3.689024

In[55]: top_female_ratings = mean_ratings.sort_values('F', ascending=False)

KeyErrorTraceback (most recent call last)
<ipython-input-55-641d7284b025> in <module>()
----> 1 top_female_ratings = mean_ratings.sort_values('F', ascending=False)

C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\frame.pyc in sort_values(self, by, axis, ascending, inplace, kind, na_position)
4416 by = by[0]
4417 k = self._get_label_or_level_values(by, axis=axis,
-> 4418 stacklevel=stacklevel)
4419
4420 if isinstance(ascending, (tuple, list)):

C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\generic.pyc in _get_label_or_level_values(self, key, axis, stacklevel)
1377 values = self.axes[axis].get_level_values(key)._values
1378 else:
-> 1379 raise KeyError(key)
1380
1381 # Check for duplicates

KeyError: 'F'

#### Expected Output

#### Output of ``pd.show_versions()``

<details>

pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.15.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.23.0
pytest: 3.5.1
pip: 10.0.1
setuptools: 39.1.0
Cython: 0.28.2
numpy: 1.14.3
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 5.7.0
sphinx: 1.7.4
patsy: 0.5.0
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: 1.2.1
tables: 3.4.3
numexpr: 2.6.5
feather: None
matplotlib: 2.2.2
openpyxl: 2.5.3
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.4
lxml: 4.2.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.7
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

</details>

Issue 2:
It looks like various functions that rely on hash tables fail when complex numbers are present, as it appears they only use the real component.

Consider the following list of values:

In [2]: x = [0, 1j, 1, 1+1j, 1+2j]

In [3]: x
Out[3]: [0, 1j, 1, (1+1j), (1+2j)]

Using value_counts:

In [4]: pd.value_counts(x)
Out[4]:
(1+0j) 3
0j 2
dtype: int64

Using unique:

In [5]: pd.unique(x)
Out[5]: array([ 0., 1.])

Using duplicated:

In [6]: pd.Series(x).duplicated()
Out[6]:
0 False
1 True
2 False
3 True
4 True
dtype: bool

Using isin:

In [7]: pd.Series(x).isin([1j, 1+1j, 1+2j])
Out[7]:
0 False
1 False
2 False
3 False
4 False
dtype: bool

In [8]: pd.Series(x).isin([0, 1])
Out[8]:
0 True
1 True
2 True
3 True
4 True
dtype: bool

Using factorize fails as described in #16399, and multiple other functions fail in similar ways (rank, nunique, mode, etc.).

Note that these appear to work if the dtype is explicitly set to object instead of complex64:

In [9]: pd.Series(x, dtype=object).isin([0, 1])
Out[9]:
0 True
1 False
2 True
3 False
4 False
dtype: bool

Output of pd.show_versions()

INSTALLED VERSIONS

commit: 51c5f4d

python: 3.6.1.final.0

python-bits: 64

OS: Windows

OS-release: 10

machine: AMD64

processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel

byteorder: little

LC_ALL: None

LANG: None

LOCALE: None.None

pandas: 0.21.0rc1+26.g51c5f4d

pytest: 3.1.2

pip: 9.0.1

setuptools: 27.2.0

Cython: 0.25.2

numpy: 1.13.1

scipy: 0.19.1

pyarrow: 0.6.0

xarray: 0.9.6

IPython: 6.1.0

sphinx: 1.5.6

patsy: 0.4.1

dateutil: 2.6.0

pytz: 2017.2

blosc: None

bottleneck: None

tables: 3.4.2

numexpr: 2.6.2

feather: 0.4.0

matplotlib: 2.0.2

openpyxl: 2.4.8

xlrd: 1.1.0

xlwt: 1.3.0

xlsxwriter: 0.9.8

lxml: 3.8.0

bs4: None

html5lib: 0.999

sqlalchemy: 1.1.13

pymysql: None

psycopg2: None

jinja2: 2.9.6

s3fs: None

fastparquet: 0.1.0

pandas_gbq: None

pandas_datareader: None