Pandas version checks
- [x] 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 https://github.com/pandas-dev/pandas-stubs/issues/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 https://github.com/pandas-dev/pandas-stubs/pull/1193 for the potential typehinting.
Comment From: arthurlw
Thanks for raising! I agree that the docs could be clearer and that **kwargs
should be replaced with the arguments you listed.
Comment From: loicdiridollou
Great thanks Arthur! I’ll prepare a PR to improve function signature and docs, it is helpful for the stubs in particular.
On Thu, May 8, 2025 at 3:20 AM Arthur Laureus Wigo @.***> wrote:
arthurlw left a comment (pandas-dev/pandas#61405) https://github.com/pandas-dev/pandas/issues/61405#issuecomment-2862037343
Thanks for raising! I agree that the docs could be clearer and that **kwargs should be replaced with the arguments you listed.
— Reply to this email directly, view it on GitHub https://github.com/pandas-dev/pandas/issues/61405#issuecomment-2862037343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMQNSQEQVYRYHMEHRB6VDOD25MASRAVCNFSM6AAAAAB4VHSL36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNRSGAZTOMZUGM . You are receiving this because you authored the thread.Message ID: @.***>