nodejs-polars
    Preparing search index...

    Interface Expr

    Expressions that can be used in various contexts.

    interface Expr {
        _expr: any;
        "[INSPECT_SYMBOL]"(): string;
        "[toStringTag]"(): string;
        abs(): pl.Expr;
        add(other: any): pl.Expr;
        aggGroups(): pl.Expr;
        alias(name: string): pl.Expr;
        and(other: any): pl.Expr;
        arccos(): pl.Expr;
        arccosh(): pl.Expr;
        arcsin(): pl.Expr;
        arcsinh(): pl.Expr;
        arctan(): pl.Expr;
        arctanh(): pl.Expr;
        argMax(): pl.Expr;
        argMin(): pl.Expr;
        argSort(descending?: boolean, maintainOrder?: boolean): pl.Expr;
        argSort(
            __namedParameters: { maintainOrder?: boolean; reverse?: boolean },
        ): pl.Expr;
        argSort(
            __namedParameters: { descending?: boolean; maintainOrder?: boolean },
        ): pl.Expr;
        argUnique(): pl.Expr;
        as(name: string): pl.Expr;
        backwardFill(): pl.Expr;
        cast(dtype: DataType, strict?: boolean): pl.Expr;
        ceil(): pl.Expr;
        clip(min: number, max: number): pl.Expr;
        clip(options: { max: number; min: number }): any;
        cos(): pl.Expr;
        cosh(): pl.Expr;
        cot(): pl.Expr;
        count(): pl.Expr;
        cumCount(reverse?: boolean): pl.Expr;
        cumCount(__namedParameters: { reverse: boolean }): pl.Expr;
        cumMax(reverse?: boolean): pl.Expr;
        cumMax(__namedParameters: { reverse: boolean }): pl.Expr;
        cumMin(reverse?: boolean): pl.Expr;
        cumMin(__namedParameters: { reverse: boolean }): pl.Expr;
        cumProd(reverse?: boolean): pl.Expr;
        cumProd(__namedParameters: { reverse: boolean }): pl.Expr;
        cumSum(reverse?: boolean): pl.Expr;
        cumSum(__namedParameters: { reverse: boolean }): pl.Expr;
        get date(): DatetimeNamespace;
        diff(n: number, nullBehavior: "ignore" | "drop"): pl.Expr;
        diff(o: { n: number; nullBehavior: "ignore" | "drop" }): pl.Expr;
        div(other: any): pl.Expr;
        divideBy(other: any): pl.Expr;
        dot(other: any): pl.Expr;
        eq(other: any): pl.Expr;
        equals(other: any): pl.Expr;
        ewmMean(): pl.Expr;
        ewmMean(
            alpha?: number,
            adjust?: boolean,
            minPeriods?: number,
            bias?: boolean,
            ignoreNulls?: boolean,
        ): pl.Expr;
        ewmMean(
            opts: {
                adjust?: boolean;
                alpha?: number;
                bias?: boolean;
                ignoreNulls?: boolean;
                minPeriods?: number;
            },
        ): pl.Expr;
        ewmStd(): pl.Expr;
        ewmStd(
            alpha?: number,
            adjust?: boolean,
            minPeriods?: number,
            bias?: boolean,
            ignoreNulls?: boolean,
        ): pl.Expr;
        ewmStd(
            opts: {
                adjust?: boolean;
                alpha?: number;
                bias?: boolean;
                ignoreNulls?: boolean;
                minPeriods?: number;
            },
        ): pl.Expr;
        ewmVar(): pl.Expr;
        ewmVar(
            alpha?: number,
            adjust?: boolean,
            minPeriods?: number,
            bias?: boolean,
            ignoreNulls?: boolean,
        ): pl.Expr;
        ewmVar(
            opts: {
                adjust?: boolean;
                alpha?: number;
                bias?: boolean;
                ignoreNulls?: boolean;
                minPeriods?: number;
            },
        ): pl.Expr;
        exclude(column: string, ...columns: string[]): pl.Expr;
        exp(): pl.Expr;
        explode(): pl.Expr;
        extend(value: any, n: number): pl.Expr;
        extend(opt: { n: number; value: any }): pl.Expr;
        extendConstant(value: any, n: number): pl.Expr;
        extendConstant(opt: { n: number; value: any }): pl.Expr;
        fillNan(other: any): pl.Expr;
        fillNull(other: any): pl.Expr;
        filter(predicate: pl.Expr): pl.Expr;
        first(): pl.Expr;
        flatten(): pl.Expr;
        floor(): pl.Expr;
        forwardFill(): pl.Expr;
        gather(index: pl.Expr | pl.Series<any, string> | number[]): pl.Expr;
        gather(
            __namedParameters: {
                index: pl.Expr | pl.Series<any, string> | number[];
            },
        ): pl.Expr;
        gatherEvery(n: number, offset?: number): pl.Expr;
        greaterThan(other: any): pl.Expr;
        greaterThanEquals(other: any): pl.Expr;
        gt(other: any): pl.Expr;
        gtEq(other: any): pl.Expr;
        hash(k0?: number, k1?: number, k2?: number, k3?: number): pl.Expr;
        hash(
            __namedParameters: {
                k0?: number;
                k1?: number;
                k2?: number;
                k3?: number;
            },
        ): pl.Expr;
        head(length?: number): pl.Expr;
        head(__namedParameters: { length: number }): pl.Expr;
        implode(): pl.Expr;
        inner(): any;
        interpolate(): pl.Expr;
        isDuplicated(): pl.Expr;
        isFinite(): pl.Expr;
        isFirstDistinct(): pl.Expr;
        isIn(other: any): pl.Expr;
        isInfinite(): pl.Expr;
        isNan(): pl.Expr;
        isNotNan(): pl.Expr;
        isNotNull(): pl.Expr;
        isNull(): pl.Expr;
        isUnique(): pl.Expr;
        keepName(): pl.Expr;
        kurtosis(): pl.Expr;
        kurtosis(fisher: boolean, bias?: boolean): pl.Expr;
        kurtosis(__namedParameters: { bias?: boolean; fisher?: boolean }): pl.Expr;
        last(): pl.Expr;
        lessThan(other: any): pl.Expr;
        lessThanEquals(other: any): pl.Expr;
        list(): pl.Expr;
        log(base?: number): pl.Expr;
        log1p(): pl.Expr;
        lowerBound(): pl.Expr;
        get lst(): ListNamespace;
        lt(other: any): pl.Expr;
        ltEq(other: any): pl.Expr;
        max(): pl.Expr;
        mean(): pl.Expr;
        median(): pl.Expr;
        min(): pl.Expr;
        minus(other: any): pl.Expr;
        mode(): pl.Expr;
        modulo(other: any): pl.Expr;
        mul(other: any): pl.Expr;
        multiplyBy(other: any): pl.Expr;
        neq(other: any): pl.Expr;
        not(): pl.Expr;
        notEquals(other: any): pl.Expr;
        nUnique(): pl.Expr;
        or(other: any): pl.Expr;
        over(by: ExprOrString, ...partitionBy: ExprOrString[]): pl.Expr;
        peakMax(): pl.Expr;
        peakMin(): pl.Expr;
        plus(other: any): pl.Expr;
        pow(exponent: number): pl.Expr;
        pow(__namedParameters: { exponent: number }): pl.Expr;
        prefix(prefix: string): pl.Expr;
        quantile(quantile: number | pl.Expr): pl.Expr;
        rank(method?: RankMethod, descending?: boolean): pl.Expr;
        rank(__namedParameters: { descending: boolean; method: string }): pl.Expr;
        reinterpret(signed?: boolean): pl.Expr;
        reinterpret(__namedParameters: { signed: boolean }): pl.Expr;
        rem(other: any): pl.Expr;
        repeatBy(by: string | pl.Expr): pl.Expr;
        replace(
            old: string | number | pl.Expr | (string | number)[],
            new_: string | number | pl.Expr | (string | number)[],
        ): pl.Expr;
        replace(
            __namedParameters: {
                new_?: string | number | pl.Expr | (string | number)[];
                old: unknown;
            },
        ): pl.Expr;
        replaceStrict(
            old: string | number | pl.Expr | (string | number)[],
            new_: string | number | pl.Expr | (string | number)[],
            default_?: string | number | pl.Expr | (string | number)[],
            returnDtype?: DataType,
        ): pl.Expr;
        replaceStrict(
            __namedParameters: {
                default_?: string | number | pl.Expr | (string | number)[];
                new_?: string | number | pl.Expr | (string | number)[];
                old: unknown;
                returnDtype?: DataType;
            },
        ): pl.Expr;
        reverse(): pl.Expr;
        rollingMax(options: RollingOptions): pl.Expr;
        rollingMax(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
        ): pl.Expr;
        rollingMean(options: RollingOptions): pl.Expr;
        rollingMean(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
        ): pl.Expr;
        rollingMedian(options: RollingOptions): pl.Expr;
        rollingMedian(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
        ): pl.Expr;
        rollingMin(options: RollingOptions): pl.Expr;
        rollingMin(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
        ): pl.Expr;
        rollingQuantile(options: RollingQuantileOptions): pl.Expr;
        rollingQuantile(
            quantile: number,
            interpolation?: InterpolationMethod,
            windowSize?: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
            by?: string,
            closed?: ClosedWindow,
        ): pl.Expr;
        rollingSkew(windowSize: number, bias?: boolean): pl.Expr;
        rollingSkew(options: RollingSkewOptions): pl.Expr;
        rollingStd(options: RollingOptions): pl.Expr;
        rollingStd(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
            ddof?: number,
        ): pl.Expr;
        rollingSum(options: RollingOptions): pl.Expr;
        rollingSum(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
        ): pl.Expr;
        rollingVar(options: RollingOptions): pl.Expr;
        rollingVar(
            windowSize: number,
            weights?: number[],
            minPeriods?: number[],
            center?: boolean,
            ddof?: number,
        ): pl.Expr;
        round(decimals: number): pl.Expr;
        round(options: { decimals: number }): pl.Expr;
        sample(
            opts?: { n: number; seed?: number | bigint; withReplacement?: boolean },
        ): pl.Expr;
        sample(
            opts?: {
                frac: number;
                seed?: number | bigint;
                withReplacement?: boolean;
            },
        ): pl.Expr;
        sample(
            n?: number,
            frac?: number,
            withReplacement?: boolean,
            seed?: number | bigint,
        ): pl.Expr;
        serialize(format: "json" | "bincode"): Buffer;
        shift(periods?: number): pl.Expr;
        shift(__namedParameters: { periods: number }): pl.Expr;
        shiftAndFill(periods: number, fillValue: number): pl.Expr;
        shiftAndFill(
            __namedParameters: { fillValue: number; periods: number },
        ): pl.Expr;
        sin(): pl.Expr;
        sinh(): pl.Expr;
        skew(bias?: boolean): pl.Expr;
        skew(__namedParameters: { bias: boolean }): pl.Expr;
        slice(offset: number | pl.Expr, length: number | pl.Expr): pl.Expr;
        slice(
            __namedParameters: {
                length: number | pl.Expr;
                offset: number | pl.Expr;
            },
        ): pl.Expr;
        sort(descending?: boolean, nullsLast?: boolean): pl.Expr;
        sort(
            __namedParameters: { descending?: boolean; nullsLast?: boolean },
        ): pl.Expr;
        sort(
            __namedParameters: { nullsLast?: boolean; reverse?: boolean },
        ): pl.Expr;
        sortBy(
            by: ExprOrString | ExprOrString[],
            descending?: boolean | boolean[],
        ): pl.Expr;
        sortBy(
            options: {
                by: ExprOrString | ExprOrString[];
                descending?: boolean | boolean[];
            },
        ): pl.Expr;
        sortBy(
            options: {
                by: ExprOrString | ExprOrString[];
                reverse?: boolean | boolean[];
            },
        ): pl.Expr;
        std(): pl.Expr;
        get str(): StringNamespace;
        get struct(): StructNamespace;
        sub(other: any): pl.Expr;
        suffix(suffix: string): pl.Expr;
        sum(): pl.Expr;
        tail(length?: number): pl.Expr;
        tail(__namedParameters: { length: number }): pl.Expr;
        tan(): pl.Expr;
        tanh(): pl.Expr;
        toJSON(): string;
        toString(): string;
        unique(opt: { maintainOrder: boolean }): pl.Expr;
        unique(maintainOrder?: boolean): pl.Expr;
        upperBound(): pl.Expr;
        var(): pl.Expr;
        where(predicate: pl.Expr): pl.Expr;
    }

    Hierarchy

    Index

    Properties

    _expr: any

    Accessors

    Methods - Arithmetic

    Methods - Comparison

    • Compare self to other: self >= other

      Parameters

      • other: any

      Returns pl.Expr

    Methods - Cumulative

    • Get an array with the cumulative count computed at every element.

      Parameters

      • Optionalreverse: boolean

      Returns pl.Expr

    • Parameters

      • __namedParameters: { reverse: boolean }

      Returns pl.Expr

    • Get an array with the cumulative max computes at every element.


      Parameters

      • Optionalreverse: boolean

        reverse the operation

      Returns pl.Expr

      >  const s = pl.Series("a", [1, 2, 3])
      > s.cumMax()
      shape: (3,)
      Series: 'b' [i64]
      [
      1
      2
      3
      ]
    • Parameters

      • __namedParameters: { reverse: boolean }

      Returns pl.Expr

    • Get an array with the cumulative min computed at every element.


      Parameters

      • Optionalreverse: boolean

        reverse the operation

      Returns pl.Expr

      >  const s = pl.Series("a", [1, 2, 3])
      > s.cumMin()
      shape: (3,)
      Series: 'b' [i64]
      [
      1
      1
      1
      ]
    • Parameters

      • __namedParameters: { reverse: boolean }

      Returns pl.Expr

    • Get an array with the cumulative product computed at every element.


      Parameters

      • Optionalreverse: boolean

        reverse the operation

      Returns pl.Expr

      >  const s = pl.Series("a", [1, 2, 3])
      > s.cumProd()
      shape: (3,)
      Series: 'b' [i64]
      [
      1
      2
      6
      ]
    • Parameters

      • __namedParameters: { reverse: boolean }

      Returns pl.Expr

    • Get an array with the cumulative sum computed at every element.


      Parameters

      • Optionalreverse: boolean

        reverse the operation

      Returns pl.Expr

      >  const s = pl.Series("a", [1, 2, 3])
      > s.cumSum()
      shape: (3,)
      Series: 'b' [i64]
      [
      1
      3
      6
      ]
    • Parameters

      • __namedParameters: { reverse: boolean }

      Returns pl.Expr

    Methods - Math

    • Ceil underlying floating point array to the highest integers smaller or equal to the float value. Only works on floating point Series

      Returns pl.Expr

    • Clip (limit) the values in an array to any value that fits in 64 floating point range. Only works for the following dtypes: {Int32, Int64, Float32, Float64, UInt32}. If you want to clip other dtypes, consider writing a when -> then -> otherwise expression

      Parameters

      • min: number

        Minimum value

      • max: number

        Maximum value

      Returns pl.Expr

    • Parameters

      • options: { max: number; min: number }

      Returns any

    • Floor underlying floating point array to the lowest integers smaller or equal to the float value. Only works on floating point Series

      Returns pl.Expr

    • Round underlying floating point data by decimals digits.

      Similar functionality to javascript toFixed

      Parameters

      • decimals: number

        number of decimals to round by.

      Returns pl.Expr

    • Parameters

      • options: { decimals: number }

      Returns pl.Expr

    • Sample from this DataFrame by setting either n or frac.

      Parameters

      • Optionalopts: { n: number; seed?: number | bigint; withReplacement?: boolean }

      Returns pl.Expr

      > df = pl.DataFrame({
      > "foo": [1, 2, 3],
      > "bar": [6, 7, 8],
      > "ham": ['a', 'b', 'c']
      > })
      > df.sample({n: 2})
      shape: (2, 3)
      ╭─────┬─────┬─────╮
      foobarham
      │ --- ┆ --- ┆ --- │
      i64i64str
      ╞═════╪═════╪═════╡
      16"a"
      ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
      38"c"
      ╰─────┴─────┴─────╯
    • Parameters

      • Optionalopts: { frac: number; seed?: number | bigint; withReplacement?: boolean }

      Returns pl.Expr

    • Parameters

      • Optionaln: number
      • Optionalfrac: number
      • OptionalwithReplacement: boolean
      • Optionalseed: number | bigint

      Returns pl.Expr

    Methods - Other

    • Get the group indexes of the group by operation. Should be used in aggregation context only.

      Returns pl.Expr

       >>> const df = pl.DataFrame(
      ... {
      ... "group": [
      ... "one",
      ... "one",
      ... "one",
      ... "two",
      ... "two",
      ... "two",
      ... ],
      ... "value": [94, 95, 96, 97, 97, 99],
      ... }
      ... )
      >>> df.group_by("group", maintainOrder=True).agg(pl.col("value").aggGroups())
      shape: (2, 2)
      ┌───────┬───────────┐
      groupvalue
      │ --- ┆ --- │
      strlist[u32] │
      ╞═══════╪═══════════╡
      one ┆ [0, 1, 2] │
      two ┆ [3, 4, 5] │
      └───────┴───────────┘
    • Rename the output of an expression.

      Parameters

      • name: string

        new name

      Returns pl.Expr

      > const df = pl.DataFrame({
      ... "a": [1, 2, 3],
      ... "b": ["a", "b", None],
      ... });
      > df
      shape: (3, 2)
      ╭─────┬──────╮
      ab
      │ --- ┆ --- │
      i64str
      ╞═════╪══════╡
      1"a"
      ├╌╌╌╌╌┼╌╌╌╌╌╌┤
      2"b"
      ├╌╌╌╌╌┼╌╌╌╌╌╌┤
      3null
      ╰─────┴──────╯
      > df.select([
      ... pl.col("a").alias("bar"),
      ... pl.col("b").alias("foo"),
      ... ])
      shape: (3, 2)
      ╭─────┬──────╮
      barfoo
      │ --- ┆ --- │
      i64str
      ╞═════╪══════╡
      1"a"
      ├╌╌╌╌╌┼╌╌╌╌╌╌┤
      2"b"
      ├╌╌╌╌╌┼╌╌╌╌╌╌┤
      3null
      ╰─────┴──────╯
    • Compute the element-wise value for the inverse cosine.

      Returns pl.Expr

      Expression of data type :class:Float64.

         >>> const df = pl.DataFrame({"a": [0.0]})
      >>> df.select(pl.col("a").acrcos())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      1.570796
      └──────────┘
    • Compute the element-wise value for the inverse hyperbolic cosine.

      Returns pl.Expr

      Expression of data type :class:Float64.

         >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").acrcosh())
      shape: (1, 1)
      ┌─────┐
      a
      │ --- │
      f64
      ╞═════╡
      0.0
      └─────┘
    • Compute the element-wise value for the inverse sine.

      Returns pl.Expr

      Expression of data type :class:Float64.

      >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").acrsin())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      1.570796
      └──────────┘
    • Compute the element-wise value for the inverse hyperbolic sine.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").acrsinh())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      0.881374
      └──────────┘
      *
    • Compute the element-wise value for the inverse tangent.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").arctan())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      0.785398
      └──────────┘
    • Compute the element-wise value for the inverse hyperbolic tangent.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").arctanh())
      shape: (1, 1)
      ┌─────┐
      a
      │ --- │
      f64
      ╞═════╡
      inf
      └─────┘
    • Get the index values that would sort this column.

      Parameters

      • Optionaldescending: boolean

        false -> order from small to large. - true -> order from large to small.

      • OptionalmaintainOrder: boolean

      Returns pl.Expr

      UInt32 Series

    • Parameters

      • __namedParameters: { maintainOrder?: boolean; reverse?: boolean }

      Returns pl.Expr

    • Parameters

      • __namedParameters: { descending?: boolean; maintainOrder?: boolean }

      Returns pl.Expr

    • Compute the element-wise value for the cosine.

      Returns pl.Expr

      Expression of data type :class:Float64.

         >>> const df = pl.DataFrame({"a": [0.0]})
      >>> df.select(pl.col("a").cos())
      shape: (1, 1)
      ┌─────┐
      a
      │ --- │
      f64
      ╞═════╡
      1.0
      └─────┘
    • Compute the element-wise value for the hyperbolic cosine.

      Returns pl.Expr

      Expression of data type :class:Float64.

         >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").cosh())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      1.543081
      └──────────┘
    • Compute the element-wise value for the cotangent.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").cot().round(2))
      shape: (1, 1)
      ┌──────┐
      a
      │ --- │
      f64
      ╞══════╡
      0.64
      └──────┘
    • Calculate the n-th discrete difference.

      Parameters

      • n: number

        number of slots to shift

      • nullBehavior: "ignore" | "drop"

        ignore or drop

      Returns pl.Expr

    • Parameters

      • o: { n: number; nullBehavior: "ignore" | "drop" }

      Returns pl.Expr

    • Exponentially-weighted moving average.

      Returns pl.Expr

      Expr that evaluates to a float 64 Series.

      > const df = pl.DataFrame({a: [1, 2, 3]});
      > df.select(pl.col("a").ewmMean())
      shape: (3, 1)
      ┌──────────┐
      a
      | --- │
      f64
      ╞══════════╡
      1.0
      1.666667
      2.428571
      └──────────┘
    • Parameters

      • Optionalalpha: number
      • Optionaladjust: boolean
      • OptionalminPeriods: number
      • Optionalbias: boolean
      • OptionalignoreNulls: boolean

      Returns pl.Expr

    • Parameters

      • opts: {
            adjust?: boolean;
            alpha?: number;
            bias?: boolean;
            ignoreNulls?: boolean;
            minPeriods?: number;
        }

      Returns pl.Expr

    • Exponentially-weighted standard deviation.

      Returns pl.Expr

      Expr that evaluates to a float 64 Series.

      > const df = pl.DataFrame({a: [1, 2, 3]});
      > df.select(pl.col("a").ewmStd())
      shape: (3, 1)
      ┌──────────┐
      a
      | --- │
      f64
      ╞══════════╡
      0.0
      0.707107
      0.963624
      └──────────┘
    • Parameters

      • Optionalalpha: number
      • Optionaladjust: boolean
      • OptionalminPeriods: number
      • Optionalbias: boolean
      • OptionalignoreNulls: boolean

      Returns pl.Expr

    • Parameters

      • opts: {
            adjust?: boolean;
            alpha?: number;
            bias?: boolean;
            ignoreNulls?: boolean;
            minPeriods?: number;
        }

      Returns pl.Expr

    • Exponentially-weighted variance.

      Returns pl.Expr

      Expr that evaluates to a float 64 Series.

      > const df = pl.DataFrame({a: [1, 2, 3]});
      > df.select(pl.col("a").ewmVar())
      shape: (3, 1)
      ┌──────────┐
      a
      | --- │
      f64
      ╞══════════╡
      0.0
      0.5
      0.928571
      └──────────┘
    • Parameters

      • Optionalalpha: number
      • Optionaladjust: boolean
      • OptionalminPeriods: number
      • Optionalbias: boolean
      • OptionalignoreNulls: boolean

      Returns pl.Expr

    • Parameters

      • opts: {
            adjust?: boolean;
            alpha?: number;
            bias?: boolean;
            ignoreNulls?: boolean;
            minPeriods?: number;
        }

      Returns pl.Expr

    • Exclude certain columns from a wildcard/regex selection.

      You may also use regexes in the exclude list. They must start with ^ and end with $.

      Parameters

      • column: string
      • ...columns: string[]

        Column(s) to exclude from selection

      Returns pl.Expr

       > const df = pl.DataFrame({
      ... "a": [1, 2, 3],
      ... "b": ["a", "b", None],
      ... "c": [None, 2, 1],
      ...});
      > df
      shape: (3, 3)
      ╭─────┬──────┬──────╮
      abc
      │ --- ┆ --- ┆ --- │
      i64stri64
      ╞═════╪══════╪══════╡
      1"a"null
      ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
      2"b"2
      ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
      3null1
      ╰─────┴──────┴──────╯
      > df.select(
      ... pl.col("*").exclude("b"),
      ... );
      shape: (3, 2)
      ╭─────┬──────╮
      ac
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════╡
      1null
      ├╌╌╌╌╌┼╌╌╌╌╌╌┤
      22
      ├╌╌╌╌╌┼╌╌╌╌╌╌┤
      31
      ╰─────┴──────╯
    • Compute the exponential, element-wise.

      Returns pl.Expr

       >>> const df = pl.DataFrame({"values": [1.0, 2.0, 4.0]})
      >>> df.select(pl.col("values").exp())
      shape: (3, 1)
      ┌──────────┐
      values
      │ --- │
      f64
      ╞══════════╡
      2.718282
      7.389056
      54.59815
      └──────────┘
    • Extend the Series with given number of values.

      Parameters

      • value: any

        The value to extend the Series with. This value may be null to fill with nulls.

      • n: number

        The number of values to extend.

      Returns pl.Expr

    • Parameters

      • opt: { n: number; value: any }

      Returns pl.Expr

    • Filter a single column.

      Mostly useful in in aggregation context. If you want to filter on a DataFrame level, use LazyFrame.filter.

      Parameters

      • predicate: pl.Expr

        Boolean expression.

      Returns pl.Expr

    • Take every nth value in the Series and return as a new Series.

      Parameters

      • n: number
      • Optionaloffset: number

      Returns pl.Expr

    • Hash the Series.

      Parameters

      • Optionalk0: number
      • Optionalk1: number
      • Optionalk2: number
      • Optionalk3: number

      Returns pl.Expr

    • Parameters

      • __namedParameters: { k0?: number; k1?: number; k2?: number; k3?: number }

      Returns pl.Expr

    • Check if elements of this Series are in the right Series, or List values of the right Series.

      Parameters

      • other: any

        Series of primitive type or List type.

      Returns pl.Expr

      Expr that evaluates to a Boolean Series.

      > const df = pl.DataFrame({
      ... "sets": [[1, 2, 3], [1, 2], [9, 10]],
      ... "optional_members": [1, 2, 3]
      ... });
      > df.select(
      ... pl.col("optional_members").isIn("sets").alias("contains")
      ... );
      shape: (3, 1)
      ┌──────────┐
      contains
      │ --- │
      bool
      ╞══════════╡
      true
      ├╌╌╌╌╌╌╌╌╌╌┤
      true
      ├╌╌╌╌╌╌╌╌╌╌┤
      false
      └──────────┘
    • Keep the original root name of the expression.

      A groupby aggregation often changes the name of a column. With keepName we can keep the original name of the column

      Returns pl.Expr

      > const df = pl.DataFrame({
      ... "a": [1, 2, 3],
      ... "b": ["a", "b", None],
      ... });

      > df
      ... .groupBy("a")
      ... .agg(pl.col("b").list())
      ... .sort({by:"a"});

      shape: (3, 2)
      ╭─────┬────────────╮
      ab_agg_list
      │ --- ┆ --- │
      i64list [str] │
      ╞═════╪════════════╡
      1 ┆ [a] │
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
      2 ┆ [b] │
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
      3 ┆ [null] │
      ╰─────┴────────────╯

      Keep the original column name:

      > df
      ... .groupby("a")
      ... .agg(col("b").list().keepName())
      ... .sort({by:"a"})

      shape: (3, 2)
      ╭─────┬────────────╮
      ab
      │ --- ┆ --- │
      i64list [str] │
      ╞═════╪════════════╡
      1 ┆ [a] │
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
      2 ┆ [b] │
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
      3 ┆ [null] │
      ╰─────┴────────────╯
    • Compute the logarithm to a given base.

      Parameters

      • Optionalbase: number

        Given base, defaults to e

      Returns pl.Expr

       >>> const df = pl.DataFrame({"a": [1, 2, 3]})
      >>> df.select(pl.col("a").log(base=2))
      shape: (3, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      0.0
      1.0
      1.584963
      └──────────┘
    • Compute the natural logarithm of each element plus one. This computes log(1 + x) but is more numerically stable for x close to zero.

      Returns pl.Expr

       >>> const df = pl.DataFrame({"a": [1, 2, 3]})
      >>> df.select(pl.col("a").log1p())
      shape: (3, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      0.693147
      1.098612
      1.386294
      └──────────┘
    • Apply window function over a subgroup.

      This is similar to a groupby + aggregation + self join. Or similar to window functions in Postgres

      Parameters

      • by: ExprOrString
      • ...partitionBy: ExprOrString[]

        Column(s) to partition by.

      Returns pl.Expr

      > const df = pl.DataFrame({
      ... "groups": [1, 1, 2, 2, 1, 2, 3, 3, 1],
      ... "values": [1, 2, 3, 4, 5, 6, 7, 8, 8],
      ... });
      > df.select(
      ... pl.col("groups").sum().over("groups")
      ... );
      ╭────────┬────────╮
      groupsvalues
      │ --- ┆ --- │
      i32i32
      ╞════════╪════════╡
      116
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      116
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      213
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      213
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      │ ... ┆ ... │
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      116
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      213
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      315
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      315
      ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
      116
      ╰────────┴────────╯
    • Add a prefix the to root column name of the expression.

      Parameters

      • prefix: string

      Returns pl.Expr

      > const df = pl.DataFrame({
      ... "A": [1, 2, 3, 4, 5],
      ... "fruits": ["banana", "banana", "apple", "apple", "banana"],
      ... "B": [5, 4, 3, 2, 1],
      ... "cars": ["beetle", "audi", "beetle", "beetle", "beetle"],
      ... });
      shape: (5, 4)
      ╭─────┬──────────┬─────┬──────────╮
      AfruitsBcars
      │ --- ┆ --- ┆ --- ┆ --- │
      i64stri64str
      ╞═════╪══════════╪═════╪══════════╡
      1"banana"5"beetle"
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
      2"banana"4"audi"
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
      3"apple"3"beetle"
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
      4"apple"2"beetle"
      ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
      5"banana"1"beetle"
      ╰─────┴──────────┴─────┴──────────╯
      > df.select(
      ... pl.col("*").reverse().prefix("reverse_"),
      ... )
      shape: (5, 8)
      ╭───────────┬────────────────┬───────────┬──────────────╮
      reverse_Areverse_fruitsreverse_Breverse_cars
      │ --- ┆ --- ┆ --- ┆ --- │
      i64stri64str
      ╞═══════════╪════════════════╪═══════════╪══════════════╡
      5"banana"1"beetle"
      ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
      4"apple"2"beetle"
      ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
      3"apple"3"beetle"
      ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
      2"banana"4"audi"
      ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
      1"banana"5"beetle"
      ╰───────────┴────────────────┴───────────┴──────────────╯
    • Repeat the elements in this Series n times by dictated by the number given by by. The elements are expanded into a List

      Parameters

      • by: string | pl.Expr

        Numeric column that determines how often the values will be repeated.

        The column will be coerced to UInt32. Give this dtype to make the coercion a no-op.

      Returns pl.Expr

    • Replace the given values by different values of the same data type.

      Parameters

      • old: string | number | pl.Expr | (string | number)[]

        Value or sequence of values to replace. Accepts expression input. Sequences are parsed as Series, other non-expression inputs are parsed as literals.

      • new_: string | number | pl.Expr | (string | number)[]

        Value or sequence of values to replace by. Accepts expression input. Sequences are parsed as Series, other non-expression inputs are parsed as literals. Length must match the length of old or have length 1.

      Returns pl.Expr

      • replace_strict
      • str.replace

      Replace a single value by another value. Values that were not replaced remain unchanged.

       >>> const df = pl.DataFrame({"a": [1, 2, 2, 3]});
      >>> df.withColumns(pl.col("a").replace(2, 100).alias("replaced"));
      shape: (4, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════════╡
      11
      2100
      2100
      33
      └─────┴──────────┘

      Replace multiple values by passing sequences to the old and new_ parameters.

       >>> df.withColumns(pl.col("a").replace([2, 3], [100, 200]).alias("replaced"));
      shape: (4, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════════╡
      11
      2100
      2100
      3200
      └─────┴──────────┘

      Passing a mapping with replacements is also supported as syntactic sugar. Specify a default to set all values that were not matched.

       >>> const mapping = {2: 100, 3: 200};
      >>> df.withColumns(pl.col("a").replace({ old: mapping }).alias("replaced");
      shape: (4, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════════╡
      1 ┆ -1
      2100
      2100
      3200
      └─────┴──────────┘
    • Parameters

      • __namedParameters: { new_?: string | number | pl.Expr | (string | number)[]; old: unknown }

      Returns pl.Expr

    • Replace values by different values.

      Parameters

      • old: string | number | pl.Expr | (string | number)[]

        Value or sequence of values to replace. Accepts expression input. Sequences are parsed as Series, other non-expression inputs are parsed as literals.

      • new_: string | number | pl.Expr | (string | number)[]

        Value or sequence of values to replace by. Accepts expression input. Sequences are parsed as Series, other non-expression inputs are parsed as literals. Length must match the length of old or have length 1.

      • Optionaldefault_: string | number | pl.Expr | (string | number)[]

        Set values that were not replaced to this value. Defaults to keeping the original value. Accepts expression input. Non-expression inputs are parsed as literals.

      • OptionalreturnDtype: DataType

        The data type of the resulting expression. If set to None (default), the data type is determined automatically based on the other inputs.

      Returns pl.Expr

      Replace a single value by another value. Values that were not replaced remain unchanged.

       >>> const df = pl.DataFrame({"a": [1, 2, 2, 3]});
      >>> df.withColumns(pl.col("a").replace(2, 100).alias("replaced"));
      shape: (4, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════════╡
      11
      2100
      2100
      33
      └─────┴──────────┘

      Replace multiple values by passing sequences to the old and new_ parameters.

       >>> df.withColumns(pl.col("a").replace([2, 3], [100, 200]).alias("replaced"));
      shape: (4, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════════╡
      11
      2100
      2100
      3200
      └─────┴──────────┘

      Passing a mapping with replacements is also supported as syntactic sugar. Specify a default to set all values that were not matched.

       >>> const mapping = {2: 100, 3: 200};
      >>> df.withColumns(pl.col("a").replaceStrict({ old: mapping, default_: -1, returnDtype: pl.Int64 }).alias("replaced");
      shape: (4, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      i64i64
      ╞═════╪══════════╡
      1 ┆ -1
      2100
      2100
      3200
      └─────┴──────────┘

      Replacing by values of a different data type sets the return type based on a combination of the new_ data type and either the original data type or the default data type if it was set.

       >>> const df = pl.DataFrame({"a": ["x", "y", "z"]});
      >>> const mapping = {"x": 1, "y": 2, "z": 3};
      >>> df.withColumns(pl.col("a").replaceStrict({ old: mapping }).alias("replaced"));
      shape: (3, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      strstr
      ╞═════╪══════════╡
      x1
      y2
      z3
      └─────┴──────────┘
      >>> df.withColumns(pl.col("a").replaceStrict({ old: mapping, default_: None }).alias("replaced"));
      shape: (3, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      stri64
      ╞═════╪══════════╡
      x1
      y2
      z3
      └─────┴──────────┘

      Set the returnDtype parameter to control the resulting data type directly.

       >>> df.withColumns(pl.col("a").replaceStrict({ old: mapping, returnDtype: pl.UInt8 }).alias("replaced"));
      shape: (3, 2)
      ┌─────┬──────────┐
      areplaced
      │ --- ┆ --- │
      stru8
      ╞═════╪══════════╡
      x1
      y2
      z3
      └─────┴──────────┘

      Expression input is supported for all parameters.

       >>> const df = pl.DataFrame({"a": [1, 2, 2, 3], "b": [1.5, 2.5, 5.0, 1.0]});
      >>> df.withColumns(
      ... pl.col("a").replaceStrict({
      ... old: pl.col("a").max(),
      ... new_: pl.col("b").sum(),
      ... default_: pl.col("b"),
      ... }).alias("replaced")
      ... );
      shape: (4, 3)
      ┌─────┬─────┬──────────┐
      abreplaced
      │ --- ┆ --- ┆ --- │
      i64f64f64
      ╞═════╪═════╪══════════╡
      11.51.5
      22.52.5
      25.05.0
      31.010.0
      └─────┴─────┴──────────┘
    • Parameters

      • __namedParameters: {
            default_?: string | number | pl.Expr | (string | number)[];
            new_?: string | number | pl.Expr | (string | number)[];
            old: unknown;
            returnDtype?: DataType;
        }

      Returns pl.Expr

    • Serializes object to desired format via serde

      Parameters

      Returns Buffer

    • Shift the values by a given period and fill the parts that will be empty due to this operation

      Parameters

      • Optionalperiods: number

        number of places to shift (may be negative).

      Returns pl.Expr

    • Parameters

      • __namedParameters: { periods: number }

      Returns pl.Expr

    • Shift the values by a given period and fill the parts that will be empty due to this operation

      Parameters

      • periods: number

        Number of places to shift (may be negative).

      • fillValue: number

        Fill null values with the result of this expression.

      Returns pl.Expr

    • Parameters

      • __namedParameters: { fillValue: number; periods: number }

      Returns pl.Expr

    • Compute the element-wise value for the sine.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [0.0]})
      >>> df.select(pl.col("a").sin())
      shape: (1, 1)
      ┌─────┐
      a
      │ --- │
      f64
      ╞═════╡
      0.0
      └─────┘
    • Compute the element-wise value for the hyperbolic sine.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").sinh())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      1.175201
      └──────────┘
    • Compute the sample skewness of a data set. For normally distributed data, the skewness should be about zero. For unimodal continuous distributions, a skewness value greater than zero means that there is more weight in the right tail of the distribution.


      Parameters

      • Optionalbias: boolean

        If False, then the calculations are corrected for statistical bias.

      Returns pl.Expr

    • Parameters

      • __namedParameters: { bias: boolean }

      Returns pl.Expr

    • Sort this column. In projection/ selection context the whole column is sorted.

      Parameters

      • Optionaldescending: boolean
        • false -> order from small to large.
        • true -> order from large to small.
      • OptionalnullsLast: boolean

        If true nulls are considered to be larger than any valid value

      Returns pl.Expr

    • Parameters

      • __namedParameters: { descending?: boolean; nullsLast?: boolean }

      Returns pl.Expr

    • Parameters

      • __namedParameters: { nullsLast?: boolean; reverse?: boolean }

      Returns pl.Expr

    • Sort this column by the ordering of another column, or multiple other columns. In projection/ selection context the whole column is sorted. If used in a groupby context, the groups are sorted.

      Parameters

      • by: ExprOrString | ExprOrString[]

        The column(s) used for sorting.

      • Optionaldescending: boolean | boolean[]

        false -> order from small to large. true -> order from large to small.

      Returns pl.Expr

    • Parameters

      • options: { by: ExprOrString | ExprOrString[]; descending?: boolean | boolean[] }

      Returns pl.Expr

    • Parameters

      • options: { by: ExprOrString | ExprOrString[]; reverse?: boolean | boolean[] }

      Returns pl.Expr

    • Compute the element-wise value for the tangent.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").tan().round(2))
      shape: (1, 1)
      ┌──────┐
      a
      │ --- │
      f64
      ╞══════╡
      1.56
      └──────┘
    • Compute the element-wise value for the hyperbolic tangent.

      Returns pl.Expr

      Expression of data type :class:Float64.

       >>> const df = pl.DataFrame({"a": [1.0]})
      >>> df.select(pl.col("a").tanh())
      shape: (1, 1)
      ┌──────────┐
      a
      │ --- │
      f64
      ╞══════════╡
      0.761594
      └──────────┘

    Methods - Rolling

    • Apply a rolling max (moving max) over the values in this Series.

      A window of length window_size will traverse the series. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector.

      The resulting parameters' values will be aggregated into their sum.


      Parameters

      Returns pl.Expr

    • Parameters

      • windowSize: number
      • Optionalweights: number[]
      • OptionalminPeriods: number[]
      • Optionalcenter: boolean

      Returns pl.Expr

    • Apply a rolling mean (moving mean) over the values in this Series.

      A window of length window_size will traverse the series. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector.

      The resulting parameters' values will be aggregated into their sum.


      Parameters

      Returns pl.Expr

    • Parameters

      • windowSize: number
      • Optionalweights: number[]
      • OptionalminPeriods: number[]
      • Optionalcenter: boolean

      Returns pl.Expr

    • Apply a rolling min (moving min) over the values in this Series.

      A window of length window_size will traverse the series. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector.

      The resulting parameters' values will be aggregated into their sum.


      Parameters

      Returns pl.Expr

    • Parameters

      • windowSize: number
      • Optionalweights: number[]
      • OptionalminPeriods: number[]
      • Optionalcenter: boolean

      Returns pl.Expr

    • Compute a rolling skew

      Parameters

      • windowSize: number

        Size of the rolling window

      • Optionalbias: boolean

        If false, then the calculations are corrected for statistical bias.

      Returns pl.Expr

    • Compute a rolling skew

      Parameters

      • options: RollingSkewOptions

        options for rolling mean operations

        • Optionalbias?: boolean
        • windowSize: number

      Returns pl.Expr

    • Compute a rolling std dev

      A window of length window_size will traverse the array. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector. The resulting values will be aggregated to their sum.


      Parameters

      Returns pl.Expr

    • Parameters

      • windowSize: number
      • Optionalweights: number[]
      • OptionalminPeriods: number[]
      • Optionalcenter: boolean
      • Optionalddof: number

      Returns pl.Expr

    • Apply a rolling sum (moving sum) over the values in this Series.

      A window of length window_size will traverse the series. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector.

      The resulting parameters' values will be aggregated into their sum.


      Parameters

      Returns pl.Expr

    • Parameters

      • windowSize: number
      • Optionalweights: number[]
      • OptionalminPeriods: number[]
      • Optionalcenter: boolean

      Returns pl.Expr

    • Compute a rolling variance.

      A window of length window_size will traverse the series. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector.

      The resulting parameters' values will be aggregated into their sum.


      Parameters

      Returns pl.Expr

    • Parameters

      • windowSize: number
      • Optionalweights: number[]
      • OptionalminPeriods: number[]
      • Optionalcenter: boolean
      • Optionalddof: number

      Returns pl.Expr