def check_for_ordered(self, op):
        if not self.ordered:
            raise TypeError("Categorical is not ordered for operation {op}\n"
                            "you can use .as_ordered() to change the "
                            "Categorical to an ordered one\n".format(op=op))
assert that we are ordered
dataset/ETHPy150Open pydata/pandas/pandas/core/categorical.py/Categorical.check_for_ordered