-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: eval and query not working with ea dtypes #50764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
244a2fe
5a66970
2fee569
3142077
f01d45f
7c56d2e
c010ca9
778d043
8a3d8cb
5e2327e
cef04a3
fddee23
a23523b
5b73792
467127f
9022e2e
89fe7fd
04d9a94
5268569
2fdb1d0
9f75603
b756073
931c723
4fb7a39
a0d8120
1a2c36a
73d72ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
|
||
from pandas.util._validators import validate_bool_kwarg | ||
|
||
from pandas.core.dtypes.common import is_extension_array_dtype | ||
|
||
from pandas.core.computation.engines import ENGINES | ||
from pandas.core.computation.expr import ( | ||
PARSERS, | ||
|
@@ -333,6 +335,16 @@ def eval( | |
|
||
parsed_expr = Expr(expr, engine=engine, parser=parser, env=env) | ||
|
||
if ( | ||
is_extension_array_dtype(parsed_expr.terms.return_type) | ||
or getattr(parsed_expr.terms, "operand_types", None) is not None | ||
and any( | ||
is_extension_array_dtype(elem) | ||
for elem in parsed_expr.terms.operand_types | ||
) | ||
): | ||
engine = "python" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean if a user is specifying If so, I think it would be better to explicitly raise a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, would you be ok with a RuntimeWarning? Since numexpr is the default, raising seems a bit noisy maybe? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well the issues linked already raise an exception currently, so a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am more concerned with people using our nullable option who are switching over from NumPy. Would be annoying if query/eval stop working then. But you are correct, an appropriate NotImplementedError would be an improvement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fair. Yeah a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the warning |
||
|
||
# construct the engine and evaluate the parsed expression | ||
eng = ENGINES[engine] | ||
eng_inst = eng(parsed_expr) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this hit the
except ValueError:
as above?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not totally sure, we don't have a test hitting the ValueError above, but added it down here as well