Skip to content

ENH: An argument for .query() that returns all rows #37941

@astrowonk

Description

@astrowonk

Is your feature request related to a problem?

Pandas query strings are very useful, however when using a variable to pass in the query, e.g.

df.query(my_query)

There is no null or empty my_query that will return all rows. An empty string returns a ValueError. Any non-string argument returns an error.

Describe the solution you'd like

An empty string or None or some keyword argument (even with an empty expr to .query() should return all rows.

Additional context

Without the ability to pass something to .query that returns all rows you end up with something like this, when _query may or may not set. It'd be nice to be able to avoid this conditional by having something to pass to query that returns all rows.

if _query:
   dfs = [f(x).query(_query) for x in the_list]
else:
   dfs = [f(x) for x in list]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions