Skip to content

NLargest

Sub classes

Name Children Inherits
NSmallest
datacook.engine.ops.rows

    Base classes

    Name Children Inherits
    CallOp
    datacook.engine.ops.base
    An op that is one pandas call.

    ⋔ Inheritance diagram

    graph TD
      3232373248["rows.NLargest"]
      3484306131["base.CallOp"]
      1539482213["base.Op"]
      2751680898["builtins.object"]
      3484306131 --> 3232373248
      1539482213 --> 3484306131
      2751680898 --> 1539482213

    🛈 DocStrings

    Bases: CallOp

    Source code in src/datacook/engine/ops/rows.py
    class NLargest(base.CallOp):
        id = "nlargest"
        title = _("Largest values")
        description = _("Keep the n rows with the largest values in the given columns.")
        category = categories.FILTER
        icon = "mdi.sort-numeric-descending"
        method = "nlargest"
        positional = ("n",)
    
        class Params(base.Params):
            n: int = Field(5, title=N_("Rows"), ge=0)
            columns: list[str] = Field(
                title=N_("Columns"), min_length=1, json_schema_extra={"widget": "columns"}
            )
            keep: Literal["first", "last", "all"] = Field("first", title=N_("Ties"))
    

    :fa-brands-github: Show source on GitHub