Skip to content

Commit

Permalink
DOC: Update variables a and b to names consistent with comment docume…
Browse files Browse the repository at this point in the history
…ntation #60366
  • Loading branch information
mingjji committed Nov 23, 2024
1 parent 318d878 commit 7a6ed6e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
10 changes: 6 additions & 4 deletions pandas/core/computation/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,12 @@ def eval(
is_extension_array_dtype(parsed_expr.terms.return_type)
and not is_string_dtype(parsed_expr.terms.return_type)
)
or getattr(parsed_expr.terms, "operand_types", None) is not None
and any(
(is_extension_array_dtype(elem) and not is_string_dtype(elem))
for elem in parsed_expr.terms.operand_types
or (
getattr(parsed_expr.terms, "operand_types", None) is not None
and any(
(is_extension_array_dtype(elem) and not is_string_dtype(elem))
for elem in parsed_expr.terms.operand_types
)
)
):
warnings.warn(
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/computation/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,7 @@ def _maybe_evaluate_binop(
)

if self.engine != "pytables" and (
res.op in CMP_OPS_SYMS
and getattr(lhs, "is_datetime", False)
(res.op in CMP_OPS_SYMS and getattr(lhs, "is_datetime", False))
or getattr(rhs, "is_datetime", False)
):
# all date ops must be done in python bc numexpr doesn't work
Expand Down
10 changes: 6 additions & 4 deletions pandas/core/computation/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _where_numexpr(cond, left_op, right_op):
local_dict={
"cond_value": cond,
"left_value": left_op,
"right_value": right_op
"right_value": right_op,
},
casting="safe",
)
Expand Down Expand Up @@ -261,9 +261,11 @@ def where(cond, left_op, right_op, use_numexpr: bool = True):
Whether to try to use numexpr.
"""
assert _where is not None
return (_where(cond, left_op, right_op)
if use_numexpr
else _where_standard(cond, left_op, right_op))
return (
_where(cond, left_op, right_op)
if use_numexpr
else _where_standard(cond, left_op, right_op)
)


def set_test_mode(v: bool = True) -> None:
Expand Down
11 changes: 6 additions & 5 deletions pandas/core/computation/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,12 @@ def prune(self, klass):
operand = operand.prune(klass)

if operand is not None and (
issubclass(klass, ConditionBinOp)
and operand.condition is not None
or not issubclass(klass, ConditionBinOp)
and issubclass(klass, FilterBinOp)
and operand.filter is not None
(issubclass(klass, ConditionBinOp) and operand.condition is not None)
or (
not issubclass(klass, ConditionBinOp)
and issubclass(klass, FilterBinOp)
and operand.filter is not None
)
):
return operand.invert()
return None
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/computation/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Scope:
temps : dict
"""

__slots__ = ["level", "scope", "target", "resolvers", "temps"]
__slots__ = ["level", "resolvers", "scope", "target", "temps"]
level: int
scope: DeepChainMap
resolvers: DeepChainMap
Expand Down

0 comments on commit 7a6ed6e

Please sign in to comment.