Readable filters with query
A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.
The task
Use `query` to find employees in Sales or Marketing who earn more than 60,000.
What this exercise teaches
query evaluates a string expression against the columns. Without parentheses, `a or b and c` means `a or (b and c)`, which would let every Sales employee through regardless of salary.
A hint if you get stuck
Inside query you can write `dept in [...]`, and `and` binds tighter than `or`, so use parentheses or `in`.
This exercise is part of Pro
Pro unlocks all 45 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.
You create a free account first, so Pro is attached to it.
Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.