Skip to content

to_numeric crashes python on empty dataframe column #16604

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
linar-jether opened this issue Jun 5, 2017 · 1 comment
Closed

to_numeric crashes python on empty dataframe column #16604

linar-jether opened this issue Jun 5, 2017 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request

Comments

@linar-jether
Copy link

Crash sample

In[2]: df = pd.DataFrame(columns=['maybe_empty_column'])
  ...: pd.to_numeric(df['maybe_empty_column'], errors='ignore')

Process finished with exit code -1073741819 (0xC0000005)

Problem description

When calling to_numeric on an empty DataFrame column, python crashes with an access violation exit code (0xC0000005).

Expected Output

Should return an empty series with default dtype for empty series (int64)

for some reason, some empty Series objects work and some don't:

empty_that_works = pd.Series(['blabla',])[1:]
pd.to_numeric(empty_that_works)

empty_that_doesnt_work = pd.Series(dtype=object)
pd.to_numeric(empty_that_doesnt_work)

Output of pd.show_versions()

# Paste the output here pd.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 2.7.12.final.0 python-bits: 64 OS: Windows OS-release: 8.1 machine: AMD64 processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None pandas: 0.20.1 pytest: 3.0.7 pip: 9.0.1 setuptools: 34.3.1 Cython: None numpy: 1.12.1 scipy: 0.18.1 xarray: None IPython: 5.3.0 sphinx: None patsy: 0.4.1 dateutil: 2.6.0 pytz: 2016.10 blosc: None bottleneck: None tables: None numexpr: 2.6.2 feather: None matplotlib: 1.5.3 openpyxl: None xlrd: 1.0.0 xlwt: None xlsxwriter: None lxml: None bs4: 4.5.1 html5lib: 0.9999999 sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None
@linar-jether linar-jether changed the title to_numeric crashed python on empty dataframe column to_numeric crashes python on empty dataframe column Jun 5, 2017
@TomAugspurger
Copy link
Contributor

Fixed in #16305 I believe (0.20.2 was released today, so you can try upgrading). Let me know if that doesn't fix it for you.

@TomAugspurger TomAugspurger added the Duplicate Report Duplicate issue or pull request label Jun 5, 2017
@TomAugspurger TomAugspurger added this to the No action milestone Jun 5, 2017
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