Skip to content

type kwargs in DataFrame.query according to DataFrame.eval #1173

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
MarcoGorelli opened this issue Mar 18, 2025 · 3 comments · May be fixed by #1193
Open

type kwargs in DataFrame.query according to DataFrame.eval #1173

MarcoGorelli opened this issue Mar 18, 2025 · 3 comments · May be fixed by #1193

Comments

@MarcoGorelli
Copy link
Member

Opening this so I can point to it as a todo. See #1168 for context

@loicdiridollou
Copy link
Contributor

If we look at the docs (https://pandas.pydata.org/docs/reference/api/pandas.eval.html#pandas.eval), it seems like the type would be:
dict[str, str | None | int | list | dict | object | bool]
Is that what you had in mind for that issue? I am a little concerned about the object possibility here since it would pretty much encompass most of the elements so wondering what kind of value we are trying to extract here. There could be a better way to do this to improve the typehinting, let me know.

@MarcoGorelli
Copy link
Member Author

rather than dict, i was thinking that the parameters from DataFrame.query could be added to the DataFrame.eval signature

@loicdiridollou
Copy link
Contributor

Okay that was my other idea, I am worried that:

  • It would conflict with the docs so that may be more a pandas lib question
  • It would conflict if I actually have a dictionary and I pass it to df.query(..., **dict_of_kwargs) so if we add all the args of eval there we may end up in a weird position where we can't recognize if someone pass a dict of kwargs as it should be from docs

Open to ideas

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

Successfully merging a pull request may close this issue.

2 participants