to_numeric segmentation fault with empty object series #16302

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

Comments

Projects
None yet
4 participants
@FrenchyRaoul

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

This comment has been minimized.

Show comment
Hide comment
@TomAugspurger

TomAugspurger May 9, 2017

Contributor

Thanks, confirmed it as well.

Contributor

TomAugspurger commented May 9, 2017

Thanks, confirmed it as well.

@jorisvandenbossche

This comment has been minimized.

Show comment
Hide comment
@gfyoung

This comment has been minimized.

Show comment
Hide comment
@gfyoung

gfyoung May 9, 2017

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@FrenchyRaoul

FrenchyRaoul May 9, 2017

@FrenchyRaoul : Thanks for tracing this back

My pleasure!

@FrenchyRaoul : Thanks for tracing this back

My pleasure!

jorisvandenbossche added a commit that referenced this issue May 9, 2017

pawroman added a commit to pawroman/pandas that referenced this issue May 9, 2017

pcluo added a commit to pcluo/pandas that referenced this issue May 22, 2017

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue May 29, 2017

TomAugspurger added a commit that referenced this issue May 30, 2017

stangirala added a commit to stangirala/pandas that referenced this issue Jun 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment