Skip to content

SetCategories

Base classes

Name Children Inherits
_CategoryOp
datacook.engine.ops.categorical

⋔ Inheritance diagram

graph TD
  117483435["categorical.SetCategories"]
  2967574147["categorical._CategoryOp"]
  2451904138["series.SeriesOp"]
  124287307["series.ColumnOp"]
  1539482213["base.Op"]
  2751680898["builtins.object"]
  2967574147 --> 117483435
  2451904138 --> 2967574147
  124287307 --> 2451904138
  1539482213 --> 124287307
  2751680898 --> 1539482213

🛈 DocStrings

Bases: _CategoryOp

Source code in src/datacook/engine/ops/categorical.py
class SetCategories(_CategoryOp):
    id = "cat_set_categories"
    title = _("Set categories")
    description = _(
        "Replace the categories: values not in the new categories become missing,"
        " new categories are added."
    )
    icon = "mdi.format-list-bulleted-type"
    method = "set_categories"
    positional = ("new_categories",)

    class Params(base.Params):
        column: str = _column()
        new_categories: list[Scalar] = Field(title=N_("Categories"))
        ordered: bool | None = Field(None, title=N_("Ordered"))
        rename: bool = Field(False, title=N_("Rename (match by position)"))

:fa-brands-github: Show source on GitHub