Skip to content

BUG: bug in json lib when frame has length zero #9805

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

Merged
merged 1 commit into from
Apr 3, 2015

Conversation

behzadnouri
Copy link
Contributor

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: []

shoyer added a commit that referenced this pull request Apr 3, 2015
BUG: bug in json lib when frame has length zero
@shoyer shoyer merged commit 0222024 into pandas-dev:master Apr 3, 2015
@shoyer
Copy link
Member

shoyer commented Apr 3, 2015

Awesome, thanks!

@behzadnouri
Copy link
Contributor Author

@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
Copy link
Member

shoyer commented Apr 3, 2015

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

@shoyer
Copy link
Member

shoyer commented Apr 3, 2015

can you test your new code on that pickle file?

@behzadnouri behzadnouri deleted the json-seg-fault branch April 4, 2015 11:18
@jreback jreback added Bug IO JSON read_json, to_json, json_normalize labels Apr 17, 2015
@jreback jreback added this to the 0.16.1 milestone Apr 17, 2015
@dashesy
Copy link
Contributor

dashesy commented May 6, 2015

I hit this error in 0.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug in dataframe.to_json causing segfault with 0.16.0
4 participants