Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 12 commits into from
May 20, 2025
Merged
Prev Previous commit
Next Next commit
GH61405 Expose arguments in DataFrame.query
  • Loading branch information
loicdiridollou committed May 9, 2025
commit b8267cbc1282f8945ad4961203e200c4dfa63614
23 changes: 12 additions & 11 deletions 23 pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4524,7 +4524,7 @@ def query(
self,
expr: str,
*,
parser: Literal["pandas", "python"] = ...,
parser: Literal["pandas", "python"] = "pandas",
engine: Literal["python", "numexpr"] | None = None,
local_dict: dict[str, Any] | None = None,
global_dict: dict[str, Any] | None = None,
Expand Down Expand Up @@ -4669,16 +4669,17 @@ def query(
msg = f"expr must be a string to be evaluated, {type(expr)} given"
raise ValueError(msg)

res = self.eval(
expr,
parser,
engine,
local_dict,
global_dict,
resolvers,
level + 1,
target,
)
kwargs = {
"parser": parser,
"engine": engine,
"local_dict": local_dict,
"global_dict": global_dict,
"resolvers": resolvers,
"level": level + 1,
"target": None,
}

res = self.eval(expr, **kwargs)

try:
result = self.loc[res]
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.