Skip to content

CLN: Expose arguments in DataFrame.query #61413

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

loicdiridollou
Copy link
Member

@loicdiridollou loicdiridollou marked this pull request as draft May 9, 2025 03:18
@loicdiridollou loicdiridollou marked this pull request as ready for review May 10, 2025 12:23
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@@ -4624,8 +4694,15 @@ def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | No
if not isinstance(expr, str):
msg = f"expr must be a string to be evaluated, {type(expr)} given"
raise ValueError(msg)
kwargs["level"] = kwargs.pop("level", 0) + 1
kwargs["target"] = None
kwargs: Any = {
Copy link
Member

Choose a reason for hiding this comment

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

It appears to me there is no reason to construct a dict here anymore. Assuming that's correct, can you instead pass these as normal function arugments.

@@ -401,6 +401,7 @@ Other API changes
- Index set operations (like union or intersection) will now ignore the dtype of
an empty ``RangeIndex`` or empty ``Index`` with object dtype when determining
the dtype of the resulting Index (:issue:`60797`)
- :meth:`DataFrame.query` does not accept ``**kwargs`` anymore and requires passing keywords for desired arguments (:issue:`61405`)
Copy link
Member

Choose a reason for hiding this comment

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

Since this is fully backwards compatible, I think we do not need to mention this in the whatsnew.

@rhshadrach rhshadrach changed the title GH61405 Expose arguments in DataFrame.query REF: Expose arguments in DataFrame.query May 19, 2025
@rhshadrach rhshadrach added the Refactor Internal refactoring of code label May 19, 2025
@rhshadrach rhshadrach changed the title REF: Expose arguments in DataFrame.query CLN: Expose arguments in DataFrame.query May 19, 2025
@rhshadrach rhshadrach added Clean expressions pd.eval, query and removed Refactor Internal refactoring of code labels May 19, 2025
@rhshadrach rhshadrach added this to the 3.0 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean expressions pd.eval, query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC/ENH: Add full list of argument for DataFrame.query
2 participants