You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't caught it precisely but it looks as if it sometimes swallowed an exception. (New code in safe_sort is simpler - sorts each of the two arrays separately, but still with np.sort.)
It looks to me that Categorical.from_array(arr, ordered=True) should always raise now. And maybe test_constructor_unsortable from test_categorical.py needs to be rewritten.
Weird numpy behaviour
I tested numpy behaviour for several versions between 1.7 and 1.11 in python 2.7, both in a script and interactive python (not ipython).
I didn't test much in ipython, but it also (at least sometimes) swallows an exception and returns a partially sorted arr2, but prints a warning (as above).
The text was updated successfully, but these errors were encountered:
pijucha
changed the title
BUG in test_categorical.py: test_constructor_unsortable
TST/BUG in test_categorical.py: test_constructor_unsortable breaks after recent commit
Jul 20, 2016
This is a follow up to #13514 (safe sort of mixed-int arrays).
After merging this commit,
test_constructor_unsortable
in test_categorical.py breaks.According to the code there,
numpy.sort
should sort a mixed int-datetime array in python2 and numpy >= 1.10. But it doesn't.Ipython probably interferes here because in pure python2.7 I'm getting
In the old code in factorize, there was a list comprehension similar to this:
I haven't caught it precisely but it looks as if it sometimes swallowed an exception. (New code in
safe_sort
is simpler - sorts each of the two arrays separately, but still with np.sort.)It looks to me that
Categorical.from_array(arr, ordered=True)
should always raise now. And maybe test_constructor_unsortable from test_categorical.py needs to be rewritten.Weird numpy behaviour
I tested numpy behaviour for several versions between 1.7 and 1.11 in python 2.7, both in a script and interactive python (not ipython).
Script
Running the following script:
gives for numpy < 1.10:
and for numpy >= 1.10:
The exception is raised in the line following
arr2 = np.sort(arr)
.When I remove
print arr2
from the script, I'm getting "exception ignored":Interactive mode
In the interactive mode (not Ipython):
For numpy < 1.10:
For numpy >= 1.10:
(I pasted literally from a console, line by line, adding only empty lines for clarity. Calls to
arr2
puzzle me.)A behaviour for the above list comprehension may depend on whether
np.sort
raises or not on the second array in the list (here, empty).safe_sort
Calling
safe_sort
onarr
always raises. (But I don't really know why.)I didn't test much in ipython, but it also (at least sometimes) swallows an exception and returns a partially sorted
arr2
, but prints a warning (as above).The text was updated successfully, but these errors were encountered: