Skip to content

Commit

Permalink
BUG (string dtype): comparison of string column to mixed object colum…
Browse files Browse the repository at this point in the history
…n fails pandas-dev#60228
  • Loading branch information
TEARFEAR committed Nov 22, 2024
1 parent c4da919 commit 900f3b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pandas/tests/series/methods/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,15 @@ def test_compare_datetime64_and_string():
tm.assert_series_equal(result_eq1, expected_eq)
tm.assert_series_equal(result_eq2, expected_eq)
tm.assert_series_equal(result_neq, expected_neq)

def test_comparison_string_mixed_object():
pd.options.future.infer_string = True

ser_string = pd.Series(["a", "b"], dtype="string")
ser_mixed = pd.Series([1, "b"])

result = ser_string == ser_mixed
expected = pd.Series([False, True], dtype="boolean")
tm.assert_series_equal(result, expected)

pd.options.future.infer_string = False

0 comments on commit 900f3b1

Please sign in to comment.