-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
Query abs(column) == [1, 2] fails #31848
Comments
abs(column) == [1, 2]
failsabs(column) == [1, 2]
fails
abs(column) == [1, 2]
fails
It throws
Indeed, your DataFrame is of length 4, and you're comparing it to a list of length 2. As for why
works, see broadcasting |
Thanks for your quick reply, @MarcoGorelli However, this works: df.query("col == [1, 2]") returning the first and third row, so this doesn't just seem to be about broadcasting. The See also this link: https://jereze.com/fr/code/pandas-query-filter-list/ So having the corresponding example with |
Good catch, thanks for the report @klieret ! |
In
but
so in the latter case, |
Code Sample, a copy-pastable example if possible
traceback:
Problem description
A value error is raised for the query
Expected Output
Same as
df.query("col == [1, -1, 2, -2]")
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: