For the inequality in result to work, the list my_categories needs to be ordered which can be done using CategoricalDtype.