Dataset.eval works with >2 dims
#11064
Open
+791
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this ended up being a much bigger effort than expected
Dataset.evalbecause it's limited to 2 dims.query, because we should be more careful about changing that, it usesnumexprwhich is fast, and doesn't have a requirement for > 2 dims.queryinterface; e.g.and&or, etcI added some similar constraints that pandas has around limiting what
evalcan do. I'm not that confident that it's robust. and not sure how valuable it is.most of the added code is tests
Commentary from Claude below (+ Claude wrote the code, for transparency, albeit with lots of oversight)
This commit removes the dependency on pandas.eval() and implements a native expression evaluator in Dataset.eval() using Python's ast module. The new implementation provides better support for multi-dimensional arrays and maintains backward compatibility with deprecated operators through automatic transformation.
Key changes:
whats-new.rstapi.rst