-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: Refactor some sorting code in Index set operations #24533
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 | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -805,8 +805,7 @@ def test_union_name_preservation(self, first_list, second_list, first_name, | |||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
def test_union_dt_as_obj(self): | ||||||||||||||||||||||||||||||||||||||||
# TODO: Replace with fixturesult | ||||||||||||||||||||||||||||||||||||||||
with tm.assert_produces_warning(RuntimeWarning): | ||||||||||||||||||||||||||||||||||||||||
firstCat = self.strIndex.union(self.dateIndex) | ||||||||||||||||||||||||||||||||||||||||
firstCat = self.strIndex.union(self.dateIndex) | ||||||||||||||||||||||||||||||||||||||||
secondCat = self.strIndex.union(self.strIndex) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if self.dateIndex.dtype == np.object_: | ||||||||||||||||||||||||||||||||||||||||
|
@@ -1615,7 +1614,7 @@ def test_drop_tuple(self, values, to_drop): | |||||||||||||||||||||||||||||||||||||||
@pytest.mark.parametrize("method,expected", [ | ||||||||||||||||||||||||||||||||||||||||
('intersection', np.array([(1, 'A'), (2, 'A'), (1, 'B'), (2, 'B')], | ||||||||||||||||||||||||||||||||||||||||
dtype=[('num', int), ('let', 'a1')])), | ||||||||||||||||||||||||||||||||||||||||
('union', np.array([(1, 'A'), (2, 'A'), (1, 'B'), (2, 'B'), (1, 'C'), | ||||||||||||||||||||||||||||||||||||||||
('union', np.array([(1, 'A'), (1, 'B'), (1, 'C'), (2, 'A'), (2, 'B'), | ||||||||||||||||||||||||||||||||||||||||
(2, 'C')], dtype=[('num', int), ('let', 'a1')])) | ||||||||||||||||||||||||||||||||||||||||
]) | ||||||||||||||||||||||||||||||||||||||||
def test_tuple_union_bug(self, method, expected): | ||||||||||||||||||||||||||||||||||||||||
|
@@ -2242,10 +2241,7 @@ def test_copy_name(self): | |||||||||||||||||||||||||||||||||||||||
s1 = Series(2, index=first) | ||||||||||||||||||||||||||||||||||||||||
s2 = Series(3, index=second[:-1]) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
warning_type = RuntimeWarning if PY3 else None | ||||||||||||||||||||||||||||||||||||||||
with tm.assert_produces_warning(warning_type): | ||||||||||||||||||||||||||||||||||||||||
# Python 3: Unorderable types | ||||||||||||||||||||||||||||||||||||||||
s3 = s1 * s2 | ||||||||||||||||||||||||||||||||||||||||
s3 = s1 * s2 | ||||||||||||||||||||||||||||||||||||||||
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. There are a couple of places where the above warning was given. But now that the Lines 448 to 466 in 091cfbb
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. yep, this is the intent of the function |
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
assert s3.index.name == 'mario' | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
@@ -2274,16 +2270,9 @@ def test_union_base(self): | |||||||||||||||||||||||||||||||||||||||
first = index[3:] | ||||||||||||||||||||||||||||||||||||||||
second = index[:5] | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if PY3: | ||||||||||||||||||||||||||||||||||||||||
# unorderable types | ||||||||||||||||||||||||||||||||||||||||
warn_type = RuntimeWarning | ||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||
warn_type = None | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
with tm.assert_produces_warning(warn_type): | ||||||||||||||||||||||||||||||||||||||||
result = first.union(second) | ||||||||||||||||||||||||||||||||||||||||
result = first.union(second) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
expected = Index(['b', 2, 'c', 0, 'a', 1]) | ||||||||||||||||||||||||||||||||||||||||
expected = Index([0, 1, 2, 'a', 'b', 'c']) | ||||||||||||||||||||||||||||||||||||||||
tm.assert_index_equal(result, expected) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
@pytest.mark.parametrize("klass", [ | ||||||||||||||||||||||||||||||||||||||||
|
@@ -2294,14 +2283,7 @@ def test_union_different_type_base(self, klass): | |||||||||||||||||||||||||||||||||||||||
first = index[3:] | ||||||||||||||||||||||||||||||||||||||||
second = index[:5] | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if PY3: | ||||||||||||||||||||||||||||||||||||||||
# unorderable types | ||||||||||||||||||||||||||||||||||||||||
warn_type = RuntimeWarning | ||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||
warn_type = None | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
with tm.assert_produces_warning(warn_type): | ||||||||||||||||||||||||||||||||||||||||
result = first.union(klass(second.values)) | ||||||||||||||||||||||||||||||||||||||||
result = first.union(klass(second.values)) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
assert tm.equalContents(result, index) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.