From b763dcf8ef3044ed62e6867645da0053fd5fce57 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 19 Mar 2021 09:32:02 +0100 Subject: [PATCH 1/2] CLN/PERF: remove catching of numpy deprecation warning in comparison_op --- pandas/core/ops/array_ops.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pandas/core/ops/array_ops.py b/pandas/core/ops/array_ops.py index 04737d91c0d4e..0d0d7bd3de175 100644 --- a/pandas/core/ops/array_ops.py +++ b/pandas/core/ops/array_ops.py @@ -6,7 +6,6 @@ from functools import partial import operator from typing import Any -import warnings import numpy as np @@ -267,10 +266,7 @@ def comparison_op(left: ArrayLike, right: Any, op) -> ArrayLike: res_values = comp_method_OBJECT_ARRAY(op, lvalues, rvalues) else: - with warnings.catch_warnings(): - # suppress warnings from numpy about element-wise comparison - warnings.simplefilter("ignore", DeprecationWarning) - res_values = _na_arithmetic_op(lvalues, rvalues, op, is_cmp=True) + res_values = _na_arithmetic_op(lvalues, rvalues, op, is_cmp=True) return res_values From 21569854b7abea9cb57a437180d5786adc7cd26d Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 19 Mar 2021 14:46:57 +0100 Subject: [PATCH 2/2] ensure not using plain evaluate for datetime64 --- pandas/core/ops/array_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/ops/array_ops.py b/pandas/core/ops/array_ops.py index 0d0d7bd3de175..333bdbf57bab3 100644 --- a/pandas/core/ops/array_ops.py +++ b/pandas/core/ops/array_ops.py @@ -231,7 +231,7 @@ def comparison_op(left: ArrayLike, right: Any, op) -> ArrayLike: """ # NB: We assume extract_array has already been called on left and right lvalues = ensure_wrapped_if_datetimelike(left) - rvalues = right + rvalues = ensure_wrapped_if_datetimelike(right) rvalues = lib.item_from_zerodim(rvalues) if isinstance(rvalues, list):