-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Concatenate with sequence that contains empty sequences. (Trac #988) #1586
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
Attachment added by trac user kelson on 2009-01-22: numpy121b.patch |
@charris wrote on 2009-04-11 The patch is not a unified diff and can't be viewed on trac. It is also against an outdated version. It needs a closer look at the original function to see if it is good. Apart from that, I think the current behavior should be fixed, but maybe this isn't the best fix. It needs some thought. |
@charris wrote on 2009-04-11 It's a context diff and only one of the four chunks apply. |
@mwiebe wrote on 2011-03-24 This behavior is still in 1.6 beta. |
Milestone changed to |
Still here in 1.9-devel
|
Empty non-arrays no longer participate in determining the dtype of the concatenated array. Have also refactored the code to unify as much as possible the logic for flattened and non-flattened paths, unifying the error checks and adding a few more tests, both for the fixed bug and for other functionality.
Empty non-arrays no longer participate in determining the dtype of the result. Have also refactored the code quite a bit, unifying the flattened and multidim branches wherever possible, as well as the error checks. Also a handful of new tests, including both the bug fixed and existing untested functionality.
On master, |
Still seeing this on 1.15.1.
|
In my opinion, returning float64 is correct, because |
Technically true, but it's not the most intuitive result from a simple concatenate function. I will work around it, thanks for the quick answer. |
The best way to avoid this kind of problem is to work with arrays rather than lists where possible, and specify explicit dtypes in the few times when you need to convert. |
Closing |
Original ticket http://projects.scipy.org/numpy/ticket/988 on 2009-01-22 by trac user kelson, assigned to unknown.
Howdy,
After searching for this defect, perhaps nobody else has been bothered
by this behaviour, but has anybody else noticed:
I have a lot of old-style Numeric stuff that likes to concatenate lists
of indices which then were used with take [which does not like floats]. So
below [in theory] I attach my attempt at a patch so that empty items in the sequence are
not used to influence the common type that is used by PyArray_ConvertToCommonType.
Maybe it is of some value, or maybe I didn't do this in a kosher manner and
someone else has an idea of where things should be rethought for this defect?
Cheerio.
The text was updated successfully, but these errors were encountered: