Skip to content

Describe

Base classes

Name Children Inherits
SubsetCallOp
datacook.engine.ops.stats
A frame method on all columns or on the `columns` subset, with a new table as result.

⋔ Inheritance diagram

graph TD
  584929048["stats.Describe"]
  3269268830["stats.SubsetCallOp"]
  3484306131["base.CallOp"]
  1539482213["base.Op"]
  2751680898["builtins.object"]
  3269268830 --> 584929048
  3484306131 --> 3269268830
  1539482213 --> 3484306131
  2751680898 --> 1539482213

🛈 DocStrings

Bases: SubsetCallOp

Source code in src/datacook/engine/ops/stats.py
class Describe(SubsetCallOp):
    id = "describe"
    title = _("Descriptive statistics")
    description = _(
        "Count, mean, standard deviation, minimum, quartiles and maximum of each column"
        " (text columns: count, unique values, most frequent value)."
    )
    method = "describe"
    then = '.reset_index(names="statistic")'

    class Params(base.Params):
        columns: list[str] | None = _subset()
        include: Literal["all"] | None = Field(
            None,
            title=N_("Include"),
            description=N_("Empty: numeric columns only (if any); all: every column."),
        )
        percentiles: list[float] | None = Field(
            None, title=N_("Percentiles"), description=N_("Between 0 and 1; empty: quartiles.")
        )

    @classmethod
    def finish(cls, params: Any, result: Any) -> Any:
        return result.reset_index(names="statistic")

:fa-brands-github: Show source on GitHub