Description
Code Sample, a copy-pastable example if possible
>>> c = pd.api.types.CategoricalDtype(categories=['German', 'English', 'French'],
... ordered=True)
>>> pd.Index(['German', 'English', 'French'], dtype=c)
CategoricalIndex(['German', 'English', 'French'],
categories=['English', 'French', 'German'],
ordered=False, dtype='category')
Problem description
Notice that the index isn't ordered and the categories have changed location.
If construction goes through CategoricalIndex, everything is ok.
Expected Output
Expected output is CategoricalIndex(['German', 'English', 'French'], categories=['German', 'English', 'French'], ordered=True)
.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.3.final.0
python-bits: 32
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.1
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.5.0.post20170922
Cython: 0.26.1
numpy: 1.11.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.1.0
sphinx: 1.6.5
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.1.0
openpyxl: 2.4.8
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None