Skip to content
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

Segmentation fault after set_categories() #24675

Closed
henlue opened this issue Jan 8, 2019 · 2 comments · Fixed by #24680
Closed

Segmentation fault after set_categories() #24675

henlue opened this issue Jan 8, 2019 · 2 comments · Fixed by #24680
Labels
Bug Categorical Categorical Data Type Segfault Non-Recoverable Error
Milestone

Comments

@henlue
Copy link

henlue commented Jan 8, 2019

Code Sample, a copy-pastable example if possible

>>> import pandas as pd
>>> s = pd.Series(['A', 'B']).astype('category').cat.set_categories(['A'], rename=True)
>>> print(s)
Segmentation fault

Problem description

The segmentation fault occurs,

  • if set_categories() is called with fewer new categories than original categories
  • and rename is set true
  • as soon as the data is accessed.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-957.1.3.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 40.6.3
Cython: None
numpy: 1.15.4
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@WillAyd WillAyd added Bug Categorical Categorical Data Type labels Jan 8, 2019
@WillAyd
Copy link
Member

WillAyd commented Jan 8, 2019

Thanks for the report. Investigation and PRs are always welcome!

@WillAyd WillAyd added this to the Contributions Welcome milestone Jan 8, 2019
@jschendel
Copy link
Member

Simplifying a little, the same thing happens when working directly with a Categorical:

pd.Categorical(['A', 'B']).set_categories(['A'], rename=True)

@jbrockmendel jbrockmendel added the Segfault Non-Recoverable Error label Jan 8, 2019
@jschendel jschendel modified the milestones: Contributions Welcome, 0.24.0 Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type Segfault Non-Recoverable Error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants