-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: move roperators to pandas.core #40444
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
REF: move roperators to pandas.core #40444
Conversation
i think this would be marginally nicer. not a big deal. might want to move expressions.check to eg compat.numexpr |
One additional consideration is that expressions.py also contains the |
(and I still need to update the imports in conftest.py) |
Thats a fair point. Either way is fine, really. Could reasonably split expressions.py into where/evaluate pieces, but its too early in the AM to go down this rabbit hole. |
Fixed the failing tests. This should be good now (assuming we leave expressions.py in /computation as is, for now) |
One additional point here: by always importing this in Now, I checked with |
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.
LGTM cc @jreback
can we reorg a bit then, this really should be in ops logically. (not blocking here, just a further thought). |
See the discussion above, |
This PR does 2 things:
pandas.core.ops.roperator
imports to all import the module and useroperator.<rop>
instead of importing the actual functions (this makes the usage similar as for the non-reversed operators withimport operator
)roperator.py
from pandas/core/ops to pandas/core, so it can be imported inpandas.core.computation.expressions
without relying on thepandas.core.ops
module, which in its turn means we can move the inline import ofpandas.core.computation.expressions
inpandas.core.ops.array_ops
to a top-level import (better for performance for a function that is called repeatedly)I think the first change is useful anyway (can also do it as a separate PR), for the second point, a possible alternative would be to move
pandas.core.computation.expressions
from the computation/ module to the ops/ moduleOne consequence of this, though: by always importing this in
array_ops
, it gets imported onimport pandas
time, and thusnumexpr
always gets imported at that point (while now it's only a delayed import when doing a first operation).Now, I checked with
python -X importtime -c "import numpy, pandas, numexpr"
, and after already having import numpy (and pandas), also import numexpr is only a small addition (most of the import of numexpr is import numpy).Based on running that a few times, it seems to adds 1.5-2 % to the total pandas import time.