BUG: bug in json lib when frame has length zero by behzadnouri · Pull Request #9805 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation5 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

behzadnouri

closes #9781

on master:

>>> df = DataFrame(columns=['jim', 'joe'])
>>> df
Empty DataFrame
Columns: [jim, joe]
Index: []
>>> df.to_json()
'{}'

mixed type will segfault:

>>> df['joe'] = df['joe'].astype('i8')
>>> df.to_json()
Segmentation fault (core dumped)

on branch:

>>> df.to_json()
'{"jim":{},"joe":{}}'
>>> df['joe'] = df['joe'].astype('i8')
>>> read_json(df.to_json())
Empty DataFrame
Columns: [jim, joe]
Index: []

@behzadnouri

shoyer added a commit that referenced this pull request

Apr 3, 2015

@shoyer

BUG: bug in json lib when frame has length zero

@shoyer

@behzadnouri

@shoyer i am not sure this actually closes #9781

this handles the case in the comments but the OP's issue may still persists.

@shoyer

OK, that may have been a bit premature :).

@shoyer

can you test your new code on that pickle file?

@dashesy

I hit this error in 0.16.0