From dddcb83a074e7f0088565cf591fab72be4b64215 Mon Sep 17 00:00:00 2001 From: zhangbowen-coder <2439796518@qq.com> Date: Thu, 11 Dec 2025 12:15:28 +0800 Subject: [PATCH 1/2] Add support for operator & in class Expression. --- pandas/core/col.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/core/col.py b/pandas/core/col.py index 39c4a7fd016c2..be90658ed54ba 100644 --- a/pandas/core/col.py +++ b/pandas/core/col.py @@ -37,6 +37,8 @@ "__lt__": "<", "__eq__": "==", "__ne__": "!=", + "__and__" : "&", + "__rand__" : "&", } @@ -156,6 +158,10 @@ def __mod__(self, other: Any) -> Expression: def __rmod__(self, other: Any) -> Expression: return self._with_binary_op("__rmod__", other) + def __and__(self, other: Any) -> Expression: + return self._with_binary_op("__and__", other) + def __rand__(self, other: Any) -> Expression: + return self._with_binary_op("__rand__", other) def __array_ufunc__( self, ufunc: Callable[..., Any], method: str, *inputs: Any, **kwargs: Any From fb6415ddd4231ab6a7a4e0993471d20f5d139dd6 Mon Sep 17 00:00:00 2001 From: zhangbowen-coder <2439796518@qq.com> Date: Thu, 11 Dec 2025 13:28:27 +0800 Subject: [PATCH 2/2] update --- pandas/core/col.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/core/col.py b/pandas/core/col.py index be90658ed54ba..814b714bdbe2f 100644 --- a/pandas/core/col.py +++ b/pandas/core/col.py @@ -37,8 +37,8 @@ "__lt__": "<", "__eq__": "==", "__ne__": "!=", - "__and__" : "&", - "__rand__" : "&", + "__and__": "&", + "__rand__": "&", } @@ -158,8 +158,10 @@ def __mod__(self, other: Any) -> Expression: def __rmod__(self, other: Any) -> Expression: return self._with_binary_op("__rmod__", other) + def __and__(self, other: Any) -> Expression: return self._with_binary_op("__and__", other) + def __rand__(self, other: Any) -> Expression: return self._with_binary_op("__rand__", other)