|
40 | 40 | is_numeric_v_string_like,
|
41 | 41 | is_object_dtype,
|
42 | 42 | is_scalar,
|
43 |
| - is_string_dtype, |
44 | 43 | )
|
45 | 44 | from pandas.core.dtypes.generic import (
|
46 | 45 | ABCExtensionArray,
|
|
54 | 53 |
|
55 | 54 | from pandas.core import roperator
|
56 | 55 | from pandas.core.computation import expressions
|
57 |
| -from pandas.core.construction import ( |
58 |
| - array as pd_array, |
59 |
| - ensure_wrapped_if_datetimelike, |
60 |
| -) |
| 56 | +from pandas.core.construction import ensure_wrapped_if_datetimelike |
61 | 57 | from pandas.core.ops import missing
|
62 | 58 | from pandas.core.ops.dispatch import should_extension_dispatch
|
63 | 59 | from pandas.core.ops.invalid import invalid_comparison
|
@@ -325,16 +321,6 @@ def comparison_op(left: ArrayLike, right: Any, op) -> ArrayLike:
|
325 | 321 | "Lengths must match to compare", lvalues.shape, rvalues.shape
|
326 | 322 | )
|
327 | 323 |
|
328 |
| - if (is_string_dtype(lvalues) and is_object_dtype(rvalues)) or ( |
329 |
| - is_object_dtype(lvalues) and is_string_dtype(rvalues) |
330 |
| - ): |
331 |
| - if lvalues.dtype.name == "string" and rvalues.dtype == object: |
332 |
| - lvalues = lvalues.astype("string") |
333 |
| - rvalues = pd_array(rvalues, dtype="string") |
334 |
| - elif rvalues.dtype.name == "string" and lvalues.dtype == object: |
335 |
| - rvalues = rvalues.astype("string") |
336 |
| - lvalues = pd_array(lvalues, dtype="string") |
337 |
| - |
338 | 324 | if should_extension_dispatch(lvalues, rvalues) or (
|
339 | 325 | (isinstance(rvalues, (Timedelta, BaseOffset, Timestamp)) or right is NaT)
|
340 | 326 | and lvalues.dtype != object
|
|
0 commit comments