-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Convert tuple to list before _list_to_arrays
when construct DataFrame.
#25731
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
Changes from 4 commits
2f00c7f
17827de
e4e68ce
4aa629e
d6c029d
2c896f9
d9e3fe7
24fc8de
e9a0ab3
4e41de3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -422,10 +422,10 @@ def to_arrays(data, columns, coerce_float=False, dtype=None): | |
|
||
def _list_to_arrays(data, columns, coerce_float=False, dtype=None): | ||
if len(data) > 0 and isinstance(data[0], tuple): | ||
content = list(lib.to_object_array_tuples(data).T) | ||
content = list(lib.to_object_array_tuples(list(data)).T) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you move this down even futher into to_object_array There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to clarify: The tuple (or list) needs to be converted to list before send to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what i mean is push the listifying down to these 2 routines, in fact There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, the segmentation fault happens in #25691 is caused by
The I have revised the patch to remove the unused conversion in The backtrace of the segmentation fault
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, IIRC this was put in here pretty specifically, can you see why that was? in any event, I believe you can simply type the input arg to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/lib.pyx#L2325-L2337 However I still think it make sense to treat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sighingnow I agree with your point, I am not suggesting combing these routines at all, rather inside each routine the data is first cast to a list There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
else: | ||
# list of lists | ||
content = list(lib.to_object_array(data).T) | ||
content = list(lib.to_object_array(list(data)).T) | ||
return _convert_object_array(content, columns, dtype=dtype, | ||
coerce_float=coerce_float) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug in :class:
DataFrame
constructor when passing non-empty tuples would cause a segmentation fault