Pandas functions
Pandas Query Data With Categorical Variables
Query categorical variables in pandas
Pandas Query is a great way to filter your data. But what if you have categorical variables. In this case, youβre gonna want to treat them a bit differently.
The important part to remember is that you will need to put your python expression inside of a string. After that itβs all peaches and cream.
Pseudo code: For a given column or columns return the values that resolve to true
Pandas Query With Categorical Variables
Letβs take a look at a code sample