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

to_numeric segmentation fault with empty object series #16302

Closed
FrenchyRaoul opened this issue May 9, 2017 · 4 comments
Closed

to_numeric segmentation fault with empty object series #16302

FrenchyRaoul opened this issue May 9, 2017 · 4 comments
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@FrenchyRaoul
Copy link

Code Sample

from pandas import Series, to_numeric
data = Series(dtype=object)
to_numeric(data, errors='coerce', downcast='integer')

Further tracing seems to indicate the problem is likely here:

pd._libs.maybe_convert_numeric(data, set(), coerce_numeric=True)

Problem description

Running to_numeric with an empty object series causes a segmentation fault on version 0.20.1. This did not occur in version 0.19.0.

Expected Output

An empty numeric series, or a ValueError.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.1.final.0 python-bits: 64 OS: Darwin OS-release: 15.0.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8

pandas: 0.20.1
pytest: None
pip: 9.0.1
setuptools: 20.10.1
Cython: None
numpy: 1.10.4
scipy: None
xarray: None
IPython: 4.2.0
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.0b1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: 0.9.6
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
s3fs: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger TomAugspurger added Difficulty Intermediate Numeric Operations Arithmetic, Comparison, and Logical operations labels May 9, 2017
@TomAugspurger TomAugspurger added this to the 0.20.2 milestone May 9, 2017
@TomAugspurger
Copy link
Contributor

Thanks, confirmed it as well.

@jorisvandenbossche jorisvandenbossche added the Regression Functionality that used to work in a prior pandas version label May 9, 2017
@jorisvandenbossche
Copy link
Member

cc @gfyoung

@gfyoung
Copy link
Member

gfyoung commented May 9, 2017

@FrenchyRaoul : Thanks for tracing this back. Bug traces to the fact that we had assumed len(data) != 0...oops 😄

@FrenchyRaoul
Copy link
Author

@FrenchyRaoul : Thanks for tracing this back

My pleasure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

No branches or pull requests

4 participants