Skip to content

Comments

ENH: apply_where: add kwargs support#624

Merged
lucascolley merged 2 commits intodata-apis:mainfrom
mdhaber:apply_where_kwargs
Feb 23, 2026
Merged

ENH: apply_where: add kwargs support#624
lucascolley merged 2 commits intodata-apis:mainfrom
mdhaber:apply_where_kwargs

Conversation

@mdhaber
Copy link
Contributor

@mdhaber mdhaber commented Feb 19, 2026

Closes gh-612

@mdhaber
Copy link
Contributor Author

mdhaber commented Feb 20, 2026

I took a second look through this, and I don't see anything I want to change. Turned out quite clean, and it will make some dependent code much nicer.

Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

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

all seems fine to me. Want to take a look @crusaderky ?

@lucascolley lucascolley added this to the 0.10.0 milestone Feb 20, 2026
Copy link
Contributor

@crusaderky crusaderky left a comment

Choose a reason for hiding this comment

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

Minor nits only.


temp1 = f1(*(arr[cond] for arr in args))
temp1 = f1(
*(arr[cond] for arr in args), **{key: val[cond] for key, val in kwargs.items()}
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be enhanced to allow for non-array kwargs.
The workaround without it, which requires a bit of expertise to figure out, is to hide the non-array kwargs with functools.partial.

This is a strict enhancement suggestion and not blocking for this PR.

@mdhaber
Copy link
Contributor Author

mdhaber commented Feb 23, 2026

Thanks @crusaderky. Implemented all suggestions except non-array kwargs.

@lucascolley lucascolley merged commit 763ea1a into data-apis:main Feb 23, 2026
10 checks passed
@lucascolley
Copy link
Member

thanks both!

@mdhaber
Copy link
Contributor Author

mdhaber commented Feb 23, 2026

Thanks!

@lucascolley do we need to wait for a release to get this in SciPy, or can I just update the commit of the submodule now?

@lucascolley
Copy link
Member

we don't need to wait, feel to to update the submodule in a PR. I do prefer keeping submodules at tagged commits if possible though, let me see whether now would be a decent time for a release.

@mdhaber
Copy link
Contributor Author

mdhaber commented Feb 23, 2026

Thanks. I'll prepare the PR, but merge can wait until there's a tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: apply_where accept kwargs?

3 participants