Strings passed to the query method are going to look more like plain English than normal pandas code. It is possible to reference Python variables using the at symbol (@) as with depts. All DataFrame column names are available in the query namespace by simply referencing their name without inner quotes. If a string is needed, such as Female, inner quotes will need to wrap it.
Another nice feature of the query syntax is the ability to write a double inequality in a single expression and its ability to understand the verbose logical operators and, or, and not instead of their bitwise equivalents as with boolean indexing.