Skip to content

DOC/ENH: Add full list of argument for DataFrame.query #61405

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
1 task done
loicdiridollou opened this issue May 8, 2025 · 2 comments · May be fixed by #61413
Open
1 task done

DOC/ENH: Add full list of argument for DataFrame.query #61405

loicdiridollou opened this issue May 8, 2025 · 2 comments · May be fixed by #61413
Assignees
Labels

Comments

@loicdiridollou
Copy link
Member

loicdiridollou commented May 8, 2025

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query

Documentation problem

This question arises when @MarcoGorelli wanted to fully type DataFrame.query in the stubs repo pandas-dev/pandas-stubs#1173. Right now the extra arguments are passed through **kwargs but when we go through the code we see that they are the same as the ones in pd.eval (https://pandas.pydata.org/docs/reference/api/pandas.eval.html#pandas.eval).

Suggested fix for documentation

Considering that this would help to expand the typehinting in that area and that the number of arguments is limited, would it be conceivable to expose all the arguments instead of relying on **kwargs?

For information this is the list of arguments that would need to be added:

parser: Literal["pandas", "python"] = ...,
engine: Literal["python", "numexpr"] | None = ...,
local_dict: dict[_str, Any] | None = ...,
global_dict: dict[_str, Any] | None = ...,
resolvers: list[Mapping] | None = ...,
level: int = ...,
target: object | None = ...,

See pandas-dev/pandas-stubs#1193 for the potential typehinting.

@loicdiridollou loicdiridollou added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels May 8, 2025
@arthurlw
Copy link
Member

arthurlw commented May 8, 2025

Thanks for raising! I agree that the docs could be clearer and that **kwargs should be replaced with the arguments you listed.

@arthurlw arthurlw removed the Needs Triage Issue that has not been reviewed by a pandas team member label May 8, 2025
@arthurlw arthurlw self-assigned this May 8, 2025
@loicdiridollou
Copy link
Member Author

loicdiridollou commented May 8, 2025 via email

@loicdiridollou loicdiridollou linked a pull request May 9, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants