Skip to content

CategoricalIndex reidex duplicates values #21999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fjdiod opened this issue Jul 20, 2018 · 2 comments
Closed

CategoricalIndex reidex duplicates values #21999

fjdiod opened this issue Jul 20, 2018 · 2 comments
Labels
Duplicate Report Duplicate issue or pull request

Comments

@fjdiod
Copy link
Contributor

fjdiod commented Jul 20, 2018

Code Sample, a copy-pastable example if possible

>>> idx = pd.CategoricalIndex(['low', 'low', 'hi', 'hi'])
>>> idx.reindex(idx)[0].values
[low, low, low, low, hi, hi, hi, hi]
Categories (2, object): [hi, low]

I'm not sure that it is unexpected behavior, but it seems to be one of the reasons for #21809

Expected Output

Output of pd.show_versions()

INSTALLED VERSIONS

commit: 0a0b2b9
python: 3.6.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-46-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.24.0.dev0+333.g0a0b2b9fc
pytest: 3.6.2
pip: 10.0.1
setuptools: 39.2.0
Cython: 0.28.3
numpy: 1.14.5
scipy: 1.1.0
pyarrow: 0.9.0
xarray: 0.10.7
IPython: 6.4.0
sphinx: 1.7.5
patsy: 0.5.0
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.5
feather: 0.4.0
matplotlib: 2.2.2
openpyxl: 2.5.4
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.5
lxml: 4.2.2
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.8
pymysql: 0.8.1
psycopg2: None
jinja2: 2.10
s3fs: 0.1.5
fastparquet: 0.1.5
pandas_gbq: None
pandas_datareader: None
gcsfs: 0.1.0

@TomAugspurger
Copy link
Contributor

We'll just keep #21809 open, since I suspect that Categorical.reindex is the only thing causing the original issue. To close that we'll test the output of Categorical.reindex and the Series / frame constructors with a CategoricalIndex

@TomAugspurger TomAugspurger added the Duplicate Report Duplicate issue or pull request label Jul 20, 2018
@TomAugspurger
Copy link
Contributor

to be clear, duplicating is certainly not the expected behavior.

@TomAugspurger TomAugspurger added this to the No action milestone Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants