Skip to content

ENH: Support third-party execution engines in Series.map #61467

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

Merged
merged 12 commits into from
May 27, 2025

Conversation

datapythonista
Copy link
Member

@datapythonista datapythonista added the Apply Apply, Aggregate, Transform, Map label May 20, 2025
@@ -20,6 +20,7 @@
timedelta_range,
)
import pandas._testing as tm
from pandas.tests.apply.conftest import engine # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this needs importing since it's already in the conftest.py

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I answered in a comment, so readers of that input don't need to ask themselves it. Most tests related to apply/map are in tests/apply, so the fixture is defined there. But it's also useful here in tests/series/methods/. test/apply/conftest.py is not in scope when running tests/series/methods, so I need to import manually in order to use it. Another alternative would be to move the fixture to the global conftest.py, but I think this approach keeps things better organized and simple.

I moved the mock classes to conftest.py as suggested, thanks for the review.

Copy link
Member

@mroeschke mroeschke May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if your work in #61125 continues to expand, I would be OK moving this to the global conftest.py

from pandas.core.groupby.base import transformation_kernels

# There is no Series.cumcount or DataFrame.cumcount
series_transform_kernels = [
x for x in sorted(transformation_kernels) if x != "cumcount"
]
frame_transform_kernels = [x for x in sorted(transformation_kernels) if x != "cumcount"]


class MockExecutionEngine(BaseExecutionEngine):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this to the conftest.py as well? In the past, I've moved away from defining objects in non test_ or conftest.py files

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Just a few questions

@datapythonista datapythonista merged commit f2f24a9 into pandas-dev:main May 27, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants