Skip to content

Commit 77e46d3

Browse files
author
shdongre
committed
don't sort array with mixed types str and int
1 parent da411b6 commit 77e46d3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pandas/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def _create_mi_with_dt64tz_level():
706706
"string-python": Index(
707707
pd.array([f"pandas_{i}" for i in range(10)], dtype="string[python]")
708708
),
709-
"mixed-int-string": Index([0, "a", 1, "b", 2, "c"]),
709+
"mixed-int-string": Index([0, "a", 1, "b", 2, "c"], dtype="mixed-int-string"),
710710
}
711711
if has_pyarrow:
712712
idx = Index(pd.array([f"pandas_{i}" for i in range(10)], dtype="string[pyarrow]"))

pandas/tests/base/test_misc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def test_searchsorted(request, index_or_series_obj):
160160
mark = pytest.mark.xfail(reason="complex objects are not comparable")
161161
request.applymarker(mark)
162162

163+
elif obj.dtype == "mixed-int-string" and isinstance(obj, Index):
164+
mark = pytest.mark.xfail(reason="np.searchsorted doesn't work on mixed types String and Int: mixed-int-string")
165+
request.applymarker(mark)
166+
163167
max_obj = max(obj, default=0)
164168
index = np.searchsorted(obj, max_obj)
165169
assert 0 <= index <= len(obj)

0 commit comments

Comments
 (0)