Skip to content

Commit 1e4f651

Browse files
PERF: no need to check for DataFrame in pandas.core.computation.expressions
1 parent 2d51ebb commit 1e4f651

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

pandas/core/computation/expressions.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
from pandas._typing import FuncType
2121

22-
from pandas.core.dtypes.generic import ABCDataFrame
23-
2422
from pandas.core.computation.check import NUMEXPR_INSTALLED
2523
from pandas.core.ops import roperator
2624

@@ -84,14 +82,8 @@ def _can_use_numexpr(op, op_str, a, b, dtype_check):
8482
# check for dtype compatibility
8583
dtypes: Set[str] = set()
8684
for o in [a, b]:
87-
# Series implements dtypes, check for dimension count as well
88-
if hasattr(o, "dtypes") and o.ndim > 1:
89-
s = o.dtypes.value_counts()
90-
if len(s) > 1:
91-
return False
92-
dtypes |= set(s.index.astype(str))
9385
# ndarray and Series Case
94-
elif hasattr(o, "dtype"):
86+
if hasattr(o, "dtype"):
9587
dtypes |= {o.dtype.name}
9688

9789
# allowed are a superset
@@ -191,8 +183,6 @@ def _where_numexpr(cond, a, b):
191183

192184

193185
def _has_bool_dtype(x):
194-
if isinstance(x, ABCDataFrame):
195-
return "bool" in x.dtypes
196186
try:
197187
return x.dtype == bool
198188
except AttributeError:

0 commit comments

Comments
 (0)