Skip to content

mode

Mode(features, *, replace=False)

Bases: Transform

Mode finds the value that appears most often in time-series features.

Initializes the Mode transform.

Parameters:

Name Type Description Default
features str | Iterable[str]

The features to apply this transform to.

required
replace bool

Whether to replace the original features with the transformed ones. If set to False, the default, the value will be added as a new feature named {feature}_mode.

False
Source code in src/flowcean/polars/transforms/mode.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def __init__(
    self,
    features: str | Iterable[str],
    *,
    replace: bool = False,
) -> None:
    """Initializes the Mode transform.

    Args:
        features: The features to apply this transform to.
        replace: Whether to replace the original features with the
            transformed ones. If set to False, the default, the value will
            be added as a new feature named `{feature}_mode`.
    """
    self.features = [features] if isinstance(features, str) else features
    self.replace = replace