def set_categories(self, new_categories, ordered=None, rename=False,
                       inplace=False):
        new_categories = self._validate_categories(new_categories)
        cat = self if inplace else self.copy()
        if rename:
            if (cat._categories is not None and
                    len(new_categories) < len(cat._categories)):
                # remove all _codes which are larger and set to -1/NaN
                self._codes[self._codes >= len(new_categories)] = -1
        else:
            values = cat.__array__()
            cat._codes = _get_codes_for_values(values, new_categories)
        cat._categories = new_categories

        if ordered is None:
            ordered = self.ordered
        cat.set_ordered(ordered, inplace=True)

        if not inplace:
            return cat
Started Event Handler
dataset/ETHPy150Open pydata/pandas/pandas/core/categorical.py/Categorical.set_categories--crossover with--dataset/ETHPy150Open circuits/circuits/examples/signals.py/App.started