-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Try to sort result of Index.union rather than guessing sortability #17378
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 all commits
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 |
---|---|---|
|
@@ -2406,35 +2406,21 @@ def union(self, other): | |
value_set = set(lvals) | ||
result.extend([x for x in rvals if x not in value_set]) | ||
else: | ||
indexer = self.get_indexer(other) | ||
indexer, = (indexer == -1).nonzero() | ||
|
||
indexer = np.where(self.get_indexer(other) == -1)[0] | ||
if len(indexer) > 0: | ||
other_diff = algos.take_nd(rvals, indexer, | ||
allow_fill=False) | ||
result = _concat._concat_compat((lvals, other_diff)) | ||
|
||
try: | ||
lvals[0] < other_diff[0] | ||
except TypeError as e: | ||
warnings.warn("%s, sort order is undefined for " | ||
"incomparable objects" % e, RuntimeWarning, | ||
stacklevel=3) | ||
else: | ||
types = frozenset((self.inferred_type, | ||
other.inferred_type)) | ||
if not types & _unsortable_types: | ||
result.sort() | ||
|
||
else: | ||
result = lvals | ||
|
||
try: | ||
result = np.sort(result) | ||
except TypeError as e: | ||
warnings.warn("%s, sort order is undefined for " | ||
"incomparable objects" % e, RuntimeWarning, | ||
stacklevel=3) | ||
try: | ||
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. you probably can simply use 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, but I left the warning as it's still raised if not even (I assume the failure is a problem with AppVeyor) |
||
result = sorting.safe_sort(result) | ||
except TypeError as e: | ||
warnings.warn("%s, sort order is undefined for " | ||
"incomparable objects" % e, RuntimeWarning, | ||
stacklevel=3) | ||
|
||
# for subclasses | ||
return self._wrap_union_result(other, result) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
:: test on windows | ||
|
||
pytest --skip-slow --skip-network pandas -n 2 -r sxX --strict %* | ||
pytest -v --skip-slow --skip-network pandas -r sxX --strict %* |
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.
so does xdist cause the issues with this?
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.
It's really hard to tell at the moment. I've just been experimenting. I'm just at a loss right now as to how that one build on AppVeyor is crashing is so badly with changes like these.