Skip to content

Rank

Base classes

Name Children Inherits
SeriesOp
datacook.engine.ops.series
A `ColumnOp` that is one call per column, declared like `CallOp`.

⋔ Inheritance diagram

graph TD
  4286094398["stats.Rank"]
  2451904138["series.SeriesOp"]
  124287307["series.ColumnOp"]
  1539482213["base.Op"]
  2751680898["builtins.object"]
  2451904138 --> 4286094398
  124287307 --> 2451904138
  1539482213 --> 124287307
  2751680898 --> 1539482213

🛈 DocStrings

Bases: SeriesOp

Source code in src/datacook/engine/ops/stats.py
class Rank(series.SeriesOp):
    id = "rank"
    title = _("Rank values")
    description = _("The rank of each value within its column (1 = smallest).")
    category = categories.STATS
    icon = "mdi.podium"
    method = "rank"

    class Params(series.ColumnParams):
        suffix: str = Field(
            "_rank",
            title=N_("Suffix for new columns"),
            description=N_("Empty: replace the columns. Otherwise the results are new columns."),
        )
        method: Literal["average", "min", "max", "first", "dense"] = Field(
            "average", title=N_("Ties"), description=N_("Rank of equal values.")
        )
        na_option: Literal["keep", "top", "bottom"] = Field("keep", title=N_("Missing values"))
        ascending: bool = Field(True, title=N_("Ascending"))
        pct: bool = Field(False, title=N_("As share (0 to 1)"))

:fa-brands-github: Show source on GitHub