-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Segfault when modifying pandas.DataFrame in-place after creating from numpy recarray #6026
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
Comments
prob need to copy the rec array elements as they go in; numpy might be sharing it somehow; this doesn't happen with a regular numpy array, but maybe the sharing is different with a rec array. want to do a PR for this? |
I upgraded Numpy 1.7.1 to 1.8 and the problem went away (BTW, the problem was present even for regular arrays, so it must have been a bug in Numpy 1.7.1 that was fixed). |
can you show what you were doing for a regular array? this shouldn't be the case....going to reopen (seg faults are bad...) |
This will trigger the segfault as well (Numpy=1.7.1 & 1.7.2, Pandas=0.13.0):
Note that the |
You are assigning over a view, see here: http://pandas.pydata.org/pandas-docs/dev/indexing.html#indexing-view-versus-copy Do this instead (you NEVER want to do kind of a chained assignment!).
Its exceedingly difficult for pandas to even detect this. I will look at this, but generally this is a bad idea. |
I understand. Thanks for the information! I wasn't aware of |
The following code generates a segfault when
use_records
is True. This segfault only occurs when the DataFrame is generated from a record array and then I attempt to modify the series in-place. This was not an issue in the previous release (v0.12) of Pandas. Tested this code against 0.13.0-268-g08c1302.The text was updated successfully, but these errors were encountered: