Skip to content
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

ENH: Groupby.transform support string input with engine=numba #53579

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

lithomas1
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@lithomas1 lithomas1 requested a review from rhshadrach as a code owner June 9, 2023 21:01
@lithomas1 lithomas1 force-pushed the numba-transform-str branch from 3572e06 to 45a2721 Compare June 9, 2023 21:02

elif func not in base.transform_kernel_allowlist:
msg = f"'{func}' is not a valid function name for transform(name)"
raise ValueError(msg)
elif func in base.cythonized_kernels or func in base.transformation_kernels:
# cythonized transform or canned "agg+broadcast"
if engine is not None:
Copy link
Member Author

Choose a reason for hiding this comment

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

Since there are no transformation kernels(e.g. cumsum, shift etc.) for numba yet, this is untested.

Should be OK, though, since this didn't work before anyways.

Copy link
Member

Choose a reason for hiding this comment

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

Curious, what type of error do we get when we pass engine="cython", engine_kwargs={"nogil": True}?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC, it gives something like

Groupby.method() got an unexpected argument engine

@td.skip_if_no("numba")
@pytest.mark.parametrize(
"agg_func", [["min", "max"], "min", {"B": ["min", "max"], "C": "sum"}]
)
def test_multifunc_notimplimented(agg_func):
Copy link
Member Author

Choose a reason for hiding this comment

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

Had to change the test since multifuncs (list/dicts of funcs) aren't supported anyways in transform for the cython engine as well.

@lithomas1 lithomas1 added Groupby numba numba-accelerated operations labels Jun 9, 2023
@mroeschke mroeschke added this to the 2.1 milestone Jun 12, 2023
@mroeschke mroeschke merged commit adc5f8b into pandas-dev:main Jun 12, 2023
@mroeschke
Copy link
Member

Thanks @lithomas1

@lithomas1 lithomas1 deleted the numba-transform-str branch June 12, 2023 23:15
canthonyscott pushed a commit to canthonyscott/pandas-anthony that referenced this pull request Jun 23, 2023
…-dev#53579)

* ENH: Groupby.transform support string input with engine=numba

* remove xfail
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
…-dev#53579)

* ENH: Groupby.transform support string input with engine=numba

* remove xfail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby numba numba-accelerated operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants