Skip to content

to_numeric segmentation fault with empty object series #16302

Closed
@FrenchyRaoul

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Numeric OperationsArithmetic, Comparison, and Logical operationsRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions