reindex
of empty CategoricalIndex sometimes fails if target is not a CategoricalIndex
#28690
Labels
Bug
Categorical
Categorical Data Type
Index
Related to the Index class or subclasses
Indexing
Related to indexing on series/frames, not to indexes themselves
Milestone
Code Sample, a copy-pastable example if possible
This fails with
AttributeError: 'Index' object has no attribute 'codes'
:The backtrace is:
Problem description
This should not fail, but rather return an
0x1
DataFrame with the new columns. Other, closely-related, expressions do work correctly in this scenario e.g.:Expected Output
Output of
pd.show_versions()
pandas: 0.24.1
pytest: 3.1.2
pip: 19.2.1
setuptools: 39.0.1
Cython: 0.29.6
numpy: 1.17.0
scipy: 1.2.1
pyarrow: 0.13.0
xarray: 0.12.1
IPython: 6.1.0
sphinx: 2.1.1
patsy: 0.4.1
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: 1.3.0.dev0
tables: None
numexpr: 2.6.9
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: 4.3.4
bs4: 4.7.1
html5lib: 0.9999999
sqlalchemy: 1.1.11
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: 0.3.1
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: