Interface Series<T, Name>

A Series represents a single column in a polars DataFrame.

interface Series<T, Name> {
    [inspect](): string;
    [iterator](): IterableIterator<DTypeToJs<T>, any, any>;
    abs(): pl.Series<T, Name>;
    add(other: any): pl.Series<T, string>;
    alias<U>(name: U): pl.Series<T, U>;
    append(other: pl.Series<any, string>): void;
    argMax(): Optional<number>;
    argMin(): Optional<number>;
    argSort(): pl.Series<T, Name>;
    argSort(descending?: boolean, nullsLast?: boolean): pl.Series<T, Name>;
    argSort(__namedParameters: {
        descending?: boolean;
        nullsLast?: boolean;
    }): pl.Series<T, Name>;
    argSort(__namedParameters: {
        nullsLast?: boolean;
        reverse?: boolean;
    }): pl.Series<T, Name>;
    argTrue(): pl.Series<T, Name>;
    argUnique(): pl.Series<T, Name>;
    as<U>(name: string): pl.Series<T, U>;
    bitand(other: pl.Series<T, string>): pl.Series<T, Name>;
    bitor(other: pl.Series<T, string>): pl.Series<T, Name>;
    bitxor(other: pl.Series<T, string>): pl.Series<T, Name>;
    cast<const U>(dtype: U, strict?: boolean): pl.Series<U, string>;
    cast(dtype: DataType, strict?: boolean): pl.Series<any, string>;
    ceil(): pl.Series<T, string>;
    chunkLengths(): T[];
    clip(min: number, max: number): pl.Series<T, string>;
    clip(options: {
        max: number;
        min: number;
    }): any;
    clone(): pl.Series<T, Name>;
    concat(other: pl.Series<T, string>): pl.Series<T, Name>;
    cumCount(reverse?: boolean): pl.Series<T, string>;
    cumCount(__namedParameters: {
        reverse: boolean;
    }): pl.Series<T, string>;
    cumMax(reverse?: boolean): pl.Series<T, string>;
    cumMax(__namedParameters: {
        reverse: boolean;
    }): pl.Series<T, string>;
    cumMin(reverse?: boolean): pl.Series<T, string>;
    cumMin(__namedParameters: {
        reverse: boolean;
    }): pl.Series<T, string>;
    cumProd(reverse?: boolean): pl.Series<T, string>;
    cumProd(__namedParameters: {
        reverse: boolean;
    }): pl.Series<T, string>;
    cumSum(reverse?: boolean): pl.Series<T, string>;
    cumSum(__namedParameters: {
        reverse: boolean;
    }): pl.Series<T, string>;
    date: SeriesDateFunctions;
    describe(): pl.DataFrame<any>;
    diff(n: number, nullBehavior: "ignore" | "drop"): pl.Series<T, Name>;
    diff(__namedParameters: {
        n: number;
        nullBehavior: "ignore" | "drop";
    }): pl.Series<T, Name>;
    div(other: any): pl.Series<T, string>;
    divideBy(other: any): pl.Series<T, string>;
    dot(other: pl.Series<any, string>): undefined | null | number;
    dropNulls(): pl.Series<T, Name>;
    dtype: T;
    eq(other: any): pl.Series<T, string>;
    equals(other: any): pl.Series<T, string>;
    ewmMean(): pl.Series<T, string>;
    ewmMean(alpha?: number, adjust?: boolean, minPeriods?: number, bias?: boolean, ignoreNulls?: boolean): pl.Series<T, string>;
    ewmMean(opts: {
        adjust?: boolean;
        alpha?: number;
        bias?: boolean;
        ignoreNulls?: boolean;
        minPeriods?: number;
    }): pl.Series<T, string>;
    ewmStd(): pl.Series<T, string>;
    ewmStd(alpha?: number, adjust?: boolean, minPeriods?: number, bias?: boolean, ignoreNulls?: boolean): pl.Series<T, string>;
    ewmStd(opts: {
        adjust?: boolean;
        alpha?: number;
        bias?: boolean;
        ignoreNulls?: boolean;
        minPeriods?: number;
    }): pl.Series<T, string>;
    ewmVar(): pl.Series<T, string>;
    ewmVar(alpha?: number, adjust?: boolean, minPeriods?: number, bias?: boolean, ignoreNulls?: boolean): pl.Series<T, string>;
    ewmVar(opts: {
        adjust?: boolean;
        alpha?: number;
        bias?: boolean;
        ignoreNulls?: boolean;
        minPeriods?: number;
    }): pl.Series<T, string>;
    explode(): any;
    extend(value: any, n: number): pl.Series<any, string>;
    extendConstant(value: any, n: number): pl.Series<any, string>;
    fillNull(strategy:
        | "backward"
        | "forward"
        | "mean"
        | "min"
        | "max"
        | "zero"
        | "one"): pl.Series<any, string>;
    fillNull(__namedParameters: {
        strategy:
            | "backward"
            | "forward"
            | "mean"
            | "min"
            | "max"
            | "zero"
            | "one";
    }): pl.Series<any, string>;
    filter(predicate: pl.Series<any, string>): pl.Series<any, string>;
    filter(__namedParameters: {
        predicate: pl.Series<any, string>;
    }): pl.Series<any, string>;
    floor(): pl.Series<T, string>;
    gather(indices: number[]): pl.Series<any, string>;
    gatherEvery(n: number, offset?: number): pl.Series<any, string>;
    get(index: number): any;
    getIndex(n: number): any;
    greaterThan(other: any): pl.Series<T, string>;
    greaterThanEquals(other: any): pl.Series<T, string>;
    gt(other: any): pl.Series<T, string>;
    gtEq(other: any): pl.Series<T, string>;
    hash(k0?: number | bigint, k1?: number | bigint, k2?: number | bigint, k3?: number | bigint): pl.Series<any, string>;
    hash(__namedParameters: {
        k0?: number | bigint;
        k1?: number | bigint;
        k2?: number | bigint;
        k3?: number | bigint;
    }): pl.Series<any, string>;
    hasValidity(): boolean;
    head(length?: number): pl.Series<any, string>;
    inner(): any;
    interpolate(method?: InterpolationMethod): pl.Series<any, string>;
    isBoolean(): boolean;
    isDateTime(): boolean;
    isDuplicated(): pl.Series<any, string>;
    isFinite(): pl.Series<any, string>;
    isFirstDistinct(): pl.Series<any, string>;
    isFloat(): boolean;
    isIn<U>(other: pl.Series<any, string> | U[]): pl.Series<any, string>;
    isInfinite(): pl.Series<any, string>;
    isNotNull(): pl.Series<any, string>;
    isNull(): pl.Series<any, string>;
    isNumeric(): boolean;
    isString(): boolean;
    isUnique(): pl.Series<any, string>;
    isUtf8(): boolean;
    kurtosis(): Optional<number>;
    kurtosis(fisher: boolean, bias?: boolean): Optional<number>;
    kurtosis(__namedParameters: {
        bias?: boolean;
        fisher?: boolean;
    }): Optional<number>;
    len(): number;
    lessThan(other: any): pl.Series<T, string>;
    lessThanEquals(other: any): pl.Series<T, string>;
    limit(n?: number): pl.Series<any, string>;
    lst: ListNamespace;
    lt(other: any): pl.Series<T, string>;
    ltEq(other: any): pl.Series<T, string>;
    max(): number;
    mean(): number;
    median(): number;
    min(): number;
    minus(other: any): pl.Series<T, string>;
    mode(): pl.Series<any, string>;
    modulo(other: any): pl.Series<T, string>;
    mul(other: any): pl.Series<T, string>;
    multiplyBy(other: any): pl.Series<T, string>;
    name: Name;
    nChunks(): number;
    neq(other: any): pl.Series<T, string>;
    notEquals(other: any): pl.Series<T, string>;
    nullCount(): number;
    nUnique(): number;
    peakMax(): pl.Series<any, string>;
    peakMin(): pl.Series<any, string>;
    plus(other: any): pl.Series<T, string>;
    quantile(quantile: number, interpolation?: string): number;
    rank(method?: RankMethod, descending?: boolean): pl.Series<any, string>;
    rechunk(): pl.Series<any, string>;
    rechunk(inPlace: true): pl.Series<any, string>;
    rechunk(inPlace: false): void;
    reinterpret(signed?: boolean): pl.Series<any, string>;
    rem(other: any): pl.Series<T, string>;
    rename(name: string): pl.Series<any, string>;
    rename(name: string, inPlace: boolean): void;
    rename(__namedParameters: {
        inPlace?: boolean;
        name: string;
    }): void;
    rename(__namedParameters: {
        inPlace: true;
        name: string;
    }): void;
    rollingMax(options: RollingOptions): pl.Series<T, string>;
    rollingMax(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean): pl.Series<T, string>;
    rollingMean(options: RollingOptions): pl.Series<T, string>;
    rollingMean(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean): pl.Series<T, string>;
    rollingMedian(options: RollingOptions): pl.Series<T, string>;
    rollingMedian(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean): pl.Series<T, string>;
    rollingMin(options: RollingOptions): pl.Series<T, string>;
    rollingMin(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean): pl.Series<T, string>;
    rollingQuantile(options: RollingQuantileOptions): pl.Series<T, string>;
    rollingQuantile(quantile: number, interpolation?: InterpolationMethod, windowSize?: number, weights?: number[], minPeriods?: number[], center?: boolean, by?: string, closed?: ClosedWindow): pl.Series<T, string>;
    rollingSkew(windowSize: number, bias?: boolean): pl.Series<T, string>;
    rollingSkew(options: RollingSkewOptions): pl.Series<T, string>;
    rollingStd(options: RollingOptions): pl.Series<T, string>;
    rollingStd(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean, ddof?: number): pl.Series<T, string>;
    rollingSum(options: RollingOptions): pl.Series<T, string>;
    rollingSum(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean): pl.Series<T, string>;
    rollingVar(options: RollingOptions): pl.Series<T, string>;
    rollingVar(windowSize: number, weights?: number[], minPeriods?: number[], center?: boolean, ddof?: number): pl.Series<T, string>;
    round(decimals: number): pl.Series<T, string>;
    round(options: {
        decimals: number;
    }): pl.Series<T, string>;
    sample(opts?: {
        n: number;
        seed?: number | bigint;
        withReplacement?: boolean;
    }): pl.Series<T, string>;
    sample(opts?: {
        frac: number;
        seed?: number | bigint;
        withReplacement?: boolean;
    }): pl.Series<T, string>;
    sample(n?: number, frac?: number, withReplacement?: boolean, seed?: number | bigint): pl.Series<T, string>;
    scatter(indices: pl.Series<any, string> | number[], value: any): void;
    serialize(format: "json" | "bincode"): Buffer;
    seriesEqual<U1>(other: pl.Series<any, string>, nullEqual?: boolean, strict?: boolean): boolean;
    set(filter: pl.Series<any, string>, value: any): pl.Series<any, string>;
    setAtIdx(indices: pl.Series<any, string> | number[], value: any): void;
    shift(periods: number): pl.Series<any, string>;
    shiftAndFill(periods: number, fillValue: number): pl.Series<any, string>;
    shiftAndFill(args: {
        fillValue: number;
        periods: number;
    }): pl.Series<any, string>;
    shrinkToFit(): pl.Series<any, string>;
    shrinkToFit(inPlace: true): void;
    skew(bias?: boolean): undefined | number;
    slice(start: number, length?: number): pl.Series<any, string>;
    sort(): pl.Series<any, string>;
    sort(options: {
        descending?: boolean;
        nullsLast?: boolean;
    }): pl.Series<any, string>;
    sort(options: {
        nullsLast?: boolean;
        reverse?: boolean;
    }): pl.Series<any, string>;
    str: StringNamespace;
    struct: SeriesStructFunctions;
    sub(other: any): pl.Series<T, string>;
    sum(): number;
    tail(length?: number): pl.Series<any, string>;
    toArray(): DTypeToJs<T>[];
    toDummies(separator?: string, dropFirst?: boolean): pl.DataFrame<any>;
    toFrame(): pl.DataFrame<any>;
    toJSON(): string;
    toObject(): {
        datatype: DtypeToJsName<T>;
        name: Name;
        values: DTypeToJs<T>[];
    };
    toTypedArray(): any;
    unique(maintainOrder?: boolean | {
        maintainOrder: boolean;
    }): pl.Series<any, string>;
    valueCounts(sort?: boolean, parallel?: boolean, name?: string, normalize?: boolean): pl.DataFrame<any>;
    values(): IterableIterator<any, any, any>;
    zipWith(mask: pl.Series<any, string>, other: pl.Series<any, string>): pl.Series<any, string>;
}

Type Parameters

  • T extends DataType = any
  • Name extends string = string

Hierarchy

Properties

date: SeriesDateFunctions
dtype: T
lst: ListNamespace
name: Name
str: StringNamespace
struct: SeriesStructFunctions

Methods - Arithmetic

  • Get the remainder of self divided by other

    Parameters

    • other: any

    Returns pl.Series<T, string>

Methods - Comparison

  • Compare self to other: self > other

    Parameters

    • other: any

    Returns pl.Series<T, string>

  • Compare self to other: self >= other

    Parameters

    • other: any

    Returns pl.Series<T, string>

  • Compare self to other: self =< other

    Parameters

    • other: any

    Returns pl.Series<T, string>

  • Compare self to other: self !== other

    Parameters

    • other: any

    Returns pl.Series<T, string>

Methods - Cumulative

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

    Parameters

    • Optionalreverse: boolean

    Returns pl.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

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


    Parameters

    • Optionalreverse: boolean

      reverse the operation

    Returns pl.Series<T, string>

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

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

    Returns pl.Series<T, string>

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


    Parameters

    • Optionalreverse: boolean

      reverse the operation

    Returns pl.Series<T, string>

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

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

    Returns pl.Series<T, string>

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


    Parameters

    • Optionalreverse: boolean

      reverse the operation

    Returns pl.Series<T, string>

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

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

    Returns pl.Series<T, string>

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


    Parameters

    • Optionalreverse: boolean

      reverse the operation

    Returns pl.Series<T, string>

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

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

    Returns pl.Series<T, string>

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.Series<T, string>

  • 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.Series<T, string>

  • Parameters

    • options: {
          max: number;
          min: number;
      }
      • 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.Series<T, string>

  • Round underlying floating point data by decimals digits.

    Similar functionality to javascript toFixed

    Parameters

    • decimals: number

      number of decimals to round by.

    Returns pl.Series<T, string>

  • Parameters

    • options: {
          decimals: number;
      }
      • decimals: number

    Returns pl.Series<T, string>

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

    Parameters

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

    Returns pl.Series<T, string>

    > 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;
      }
      • frac: number
      • Optionalseed?: number | bigint
      • OptionalwithReplacement?: boolean

    Returns pl.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

Methods - Other

  • Returns IterableIterator<DTypeToJs<T>, any, any>

  • Append a Series to this one.


    Parameters

    • other: pl.Series<any, string>

      Series to append.

    Returns void

    >  const s = pl.Series("a", [1, 2, 3])
    > const s2 = pl.Series("b", [4, 5, 6])
    > s.append(s2)
    shape: (6,)
    Series: 'a' [i64]
    [
    1
    2
    3
    4
    5
    6
    ]
  • Get the index of the maximal value.

    Returns Optional<number>

  • Get the index of the minimal value.

    Returns Optional<number>

  • __Quick summary statistics of a series. __

    Series with mixed datatypes will return summary statistics for the datatype of the first value.


    Returns pl.DataFrame<any>

    >  const seriesNum = pl.Series([1,2,3,4,5])
    > series_num.describe()

    shape: (6, 2)
    ┌──────────────┬────────────────────┐
    statisticvalue
    │ --- ┆ --- │
    strf64
    ╞══════════════╪════════════════════╡
    "min"1
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
    "max"5
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
    "null_count"0.0
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
    "mean"3
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
    "std"1.5811388300841898
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
    "count"5
    └──────────────┴────────────────────┘

    > series_str = pl.Series(["a", "a", None, "b", "c"])
    > series_str.describe()

    shape: (3, 2)
    ┌──────────────┬───────┐
    statisticvalue
    │ --- ┆ --- │
    stri64
    ╞══════════════╪═══════╡
    "unique"4
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
    "null_count"1
    ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
    "count"5
    └──────────────┴───────┘
  • Calculates the n-th discrete difference.

    Parameters

    • n: number

      number of slots to shift

    • nullBehavior: "ignore" | "drop"

      'ignore' | 'drop'

    Returns pl.Series<T, Name>

  • Parameters

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

    Returns pl.Series<T, Name>

  • Compute the dot/inner product between two Series


    Parameters

    Returns undefined | null | number

    >  const s = pl.Series("a", [1, 2, 3])
    > const s2 = pl.Series("b", [4.0, 5.0, 6.0])
    > s.dot(s2)
    32.0
  • Exponentially-weighted moving average.

    Returns pl.Series<T, string>

    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.Series<T, string>

  • Parameters

    • opts: {
          adjust?: boolean;
          alpha?: number;
          bias?: boolean;
          ignoreNulls?: boolean;
          minPeriods?: number;
      }
      • Optionaladjust?: boolean
      • Optionalalpha?: number
      • Optionalbias?: boolean
      • OptionalignoreNulls?: boolean
      • OptionalminPeriods?: number

    Returns pl.Series<T, string>

  • Exponentially-weighted standard deviation.

    Returns pl.Series<T, string>

    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.Series<T, string>

  • Parameters

    • opts: {
          adjust?: boolean;
          alpha?: number;
          bias?: boolean;
          ignoreNulls?: boolean;
          minPeriods?: number;
      }
      • Optionaladjust?: boolean
      • Optionalalpha?: number
      • Optionalbias?: boolean
      • OptionalignoreNulls?: boolean
      • OptionalminPeriods?: number

    Returns pl.Series<T, string>

  • Exponentially-weighted variance.

    Returns pl.Series<T, string>

    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.Series<T, string>

  • Parameters

    • opts: {
          adjust?: boolean;
          alpha?: number;
          bias?: boolean;
          ignoreNulls?: boolean;
          minPeriods?: number;
      }
      • Optionaladjust?: boolean
      • Optionalalpha?: number
      • Optionalbias?: boolean
      • OptionalignoreNulls?: boolean
      • OptionalminPeriods?: number

    Returns pl.Series<T, string>

  • Explode a list or utf8 Series.

    This means that every item is expanded to a new row.


    Returns any

    >  const s = pl.Series('a', [[1, 2], [3, 4], [9, 10]])
    > s.explode()
    shape: (6,)
    Series: 'a' [i64]
    [
    1
    2
    3
    4
    9
    10
    ]
  • 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.Series<any, string>

  • 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.Series<any, string>

  • Fill null values with a filling strategy.


    Parameters

    • strategy:
          | "backward"
          | "forward"
          | "mean"
          | "min"
          | "max"
          | "zero"
          | "one"

      Filling Strategy

    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1, 2, 3, None])
    > s.fill_null('forward'))
    shape: (4,)
    Series: '' [i64]
    [
    1
    2
    3
    3
    ]
    > s.fill_null('min'))
    shape: (4,)
    Series: 'a' [i64]
    [
    1
    2
    3
    1
    ]
  • Parameters

    • __namedParameters: {
          strategy:
              | "backward"
              | "forward"
              | "mean"
              | "min"
              | "max"
              | "zero"
              | "one";
      }
      • strategy:
            | "backward"
            | "forward"
            | "mean"
            | "min"
            | "max"
            | "zero"
            | "one"

    Returns pl.Series<any, string>

  • Take values by index.


    Parameters

    • indices: number[]

      Index location used for the selection

    Returns pl.Series<any, string>

    s = pl.Series("a", [1, 2, 3, 4])
    s.gather([1, 3])
    shape: (2,)
    Series: 'a' [i64]
    [
    2
    4
    ]
  • Take every nth value in the Series and return as new Series.

    Parameters

    • n: number

      Gather every n-th row

    • Optionaloffset: number

      Start the row count at this offset

    Returns pl.Series<any, string>

    s = pl.Series("a", [1, 2, 3, 4])
    s.gatherEvery(2))
    shape: (2,)
    Series: 'a' [i64]
    [
    1
    3
    ]
    s.gather_every(2, offset=1)
    shape: (2,)
    Series: 'a' [i64]
    [
    2
    4
    ]
  • Hash the Series The hash value is of type UInt64


    Parameters

    • Optionalk0: number | bigint

      seed parameter

    • Optionalk1: number | bigint

      seed parameter

    • Optionalk2: number | bigint

      seed parameter

    • Optionalk3: number | bigint

      seed parameter

    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1, 2, 3])
    > s.hash(42)
    shape: (3,)
    Series: 'a' [u64]
    [
    7499844439152382372
    821952831504499201
    6685218033491627602
    ]
  • Parameters

    • __namedParameters: {
          k0?: number | bigint;
          k1?: number | bigint;
          k2?: number | bigint;
          k3?: number | bigint;
      }
      • Optionalk0?: number | bigint
      • Optionalk1?: number | bigint
      • Optionalk2?: number | bigint
      • Optionalk3?: number | bigint

    Returns pl.Series<any, string>

  • Returns True if the Series has a validity bitmask. If there is none, it means that there are no null values.

    Returns boolean

  • Get first N elements as Series.


    Parameters

    • Optionallength: number

      Length of the head

    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1, 2, 3])
    > s.head(2)
    shape: (2,)
    Series: 'a' [i64]
    [
    1
    2
    ]
  • Interpolate intermediate values.

    The interpolation method is linear.


    Parameters

    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1, 2, None, None, 5])
    > s.interpolate()
    shape: (5,)
    Series: 'a' [i64]
    [
    1
    2
    3
    4
    5
    ]
  • Check if this Series is a Boolean.

    Returns boolean

  • Check if this Series is a DataTime.

    Returns boolean

  • Get mask of all duplicated values.

    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1, 2, 2, 3])
    > s.isDuplicated()

    shape: (4,)
    Series: 'a' [bool]
    [
    false
    true
    true
    false
    ]
  • Check if this Series is a Float.

    Returns boolean

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

    Type Parameters

    • U

    Parameters

    Returns pl.Series<any, string>

  • Get mask of infinite values if Series dtype is Float.

    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1.0, 2.0, 3.0])
    > s.isInfinite()

    shape: (3,)
    Series: 'a' [bool]
    [
    false
    false
    false
    ]
  • Get mask of non null values.

    undefined values are treated as null


    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1.0, undefined, 2.0, 3.0, null])
    > s.isNotNull()
    shape: (5,)
    Series: 'a' [bool]
    [
    true
    false
    true
    true
    false
    ]
  • Get mask of null values.

    undefined values are treated as null


    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1.0, undefined, 2.0, 3.0, null])
    > s.isNull()
    shape: (5,)
    Series: 'a' [bool]
    [
    false
    true
    false
    false
    true
    ]
  • Check if this Series datatype is numeric.

    Returns boolean

  • Checks if this Series datatype is a String.

    Returns boolean

  • Get mask of unique values.


    Returns pl.Series<any, string>

    >  const s = pl.Series("a", [1, 2, 2, 3])
    > s.isUnique()
    shape: (4,)
    Series: 'a' [bool]
    [
    true
    false
    false
    true
    ]
  • Checks if this Series datatype is a Utf8.

    Returns boolean

    since 0.8.4

    Use Series.dtype.equals(pl.String) instead.

  • Compute the kurtosis (Fisher or Pearson) of a dataset.

    Kurtosis is the fourth central moment divided by the square of the variance. If Fisher's definition is used, then 3.0 is subtracted from the result to give 0.0 for a normal distribution. If bias is False then the kurtosis is calculated using k statistics to eliminate bias coming from biased moment estimators


    Returns Optional<number>

  • Parameters

    • fisher: boolean
    • Optionalbias: boolean

    Returns Optional<number>

  • Parameters

    • __namedParameters: {
          bias?: boolean;
          fisher?: boolean;
      }
      • Optionalbias?: boolean
      • Optionalfisher?: boolean

    Returns Optional<number>

  • Length of this Series.


    Returns number

    >  const s = pl.Series("a", [1, 2, 3])
    > s.len()
    3
  • Take n elements from this Series.


    Parameters

    • Optionaln: number

      Amount of elements to take.

    Returns pl.Series<any, string>

    head

    s = pl.Series("a", [1, 2, 3])
    s.limit(2)
    shape: (2,)
    Series: 'a' [i64]
    [
    1
    2
    ]
  • Get the maximum value in this Series.

    Returns number

    > s = pl.Series("a", [1, 2, 3])
    > s.max()
    3
  • Reduce this Series to the mean value.

    Returns number

    > s = pl.Series("a", [1, 2, 3])
    > s.mean()
    2
  • Get the median of this Series

    Returns number

    > s = pl.Series("a", [1, 2, 3])
    > s.median()
    2
  • Get the minimal value in this Series.

    Returns number

    > s = pl.Series("a", [1, 2, 3])
    > s.min()
    1
  • Compute the most occurring value(s). Can return multiple Values


    Returns pl.Series<any, string>

    s = pl.Series("a", [1, 2, 2, 3])
    s.mode()
    shape: (1,)
    Series: 'a' [i64]
    [
    2
    ]

    s = pl.Series("a", ['a', 'b', 'c', 'c', 'b'])
    s.mode()
    shape: (1,)
    Series: 'a' [str]
    [
    'b'
    'c'
    ]
  • Get the number of chunks that this Series contains.

    Returns number

  • Count the null values in this Series. -- undefined values are treated as null

    Returns number

  • Count the number of unique values in this Series.


    Returns number

    s = pl.Series("a", [1, 2, 2, 3])
    s.nUnique()
    3
  • Get a boolean mask of the local maximum peaks.


    Returns pl.Series<any, string>

    s = pl.Series("a", [1, 2, 3, 4, 5])
    s.peakMax()
    shape: (5,)
    Series: '' [bool]
    [
    false
    false
    false
    false
    true
    ]
  • Get a boolean mask of the local minimum peaks.


    Returns pl.Series<any, string>

    s = pl.Series("a", [4, 1, 3, 2, 5])
    s.peakMin()
    shape: (5,)
    Series: '' [bool]
    [
    false
    true
    false
    true
    false
    ]
  • Get the quantile value of this Series.


    Parameters

    • quantile: number
    • Optionalinterpolation: string

    Returns number

    s = pl.Series("a", [1, 2, 3])
    s.quantile(0.5)
    2
  • Assign ranks to data, dealing with ties appropriately.

    Parameters

    • Optionalmethod: RankMethod

      The method used to assign ranks to tied elements.

    • Optionaldescending: boolean

      Rank in descending order.

    Returns pl.Series<any, string>

  • Reinterpret the underlying bits as a signed/unsigned integer.

    This operation is only allowed for 64bit integers. For lower bits integers, you can safely use that cast operation.


    Parameters

    • Optionalsigned: boolean

      signed or unsigned

      • True -> pl.Int64
      • False -> pl.UInt64

    Returns pl.Series<any, string>

    cast

  • Rename this Series.

    Parameters

    • name: string

      new name

    Returns pl.Series<any, string>

    alias

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

    • name: string
    • inPlace: boolean

    Returns void

  • Parameters

    • __namedParameters: {
          inPlace?: boolean;
          name: string;
      }
      • OptionalinPlace?: boolean
      • name: string

    Returns void

  • Parameters

    • __namedParameters: {
          inPlace: true;
          name: string;
      }
      • inPlace: true
      • name: string

    Returns void

  • Serializes object to desired format via serde

    Parameters

    Returns Buffer

  • Check if series is equal with another Series.

    Type Parameters

    • U1

    Parameters

    • other: pl.Series<any, string>

      Series to compare with.

    • OptionalnullEqual: boolean

      Consider null values as equal. ('undefined' is treated as null)


    • Optionalstrict: boolean

    Returns boolean

    s = pl.Series("a", [1, 2, 3])
    s2 = pl.Series("b", [4, 5, 6])
    s.series_equal(s)
    true
    s.series_equal(s2)
    false
  • Set masked values

    Parameters

    • filter: pl.Series<any, string>

      Boolean mask

    • value: any

      value to replace masked values with

    Returns pl.Series<any, string>

  • Set masked values

    Parameters

    • indices: pl.Series<any, string> | number[]
    • value: any

      value to replace masked values with

    Returns void

    0.8.4

  • Shift the values by a given period

    the parts that will be empty due to this operation will be filled with null.


    Parameters

    • periods: number

      Number of places to shift (may be negative).

    Returns pl.Series<any, string>

    s = pl.Series("a", [1, 2, 3])
    s.shift(1)
    shape: (3,)
    Series: 'a' [i64]
    [
    null
    1
    2
    ]
    s.shift(-1)
    shape: (3,)
    Series: 'a' [i64]
    [
    2
    3
    null
    ]
  • Shift the values by a given period

    the parts that will be empty due to this operation will be filled with fillValue.


    Parameters

    • periods: number

      Number of places to shift (may be negative).

    • fillValue: number

      Fill null & undefined values with the result of this expression.

    Returns pl.Series<any, string>

  • Parameters

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

    Returns pl.Series<any, string>

  • Shrink memory usage of this Series to fit the exact capacity needed to hold the data.

    Returns pl.Series<any, string>

  • Parameters

    • inPlace: true

    Returns void

  • 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. The function skewtest can be used to determine if the skewness value is close enough to zero, statistically speaking.


    Parameters

    • Optionalbias: boolean

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

    Returns undefined | number

  • Create subslices of the Series.

    Parameters

    • start: number
    • Optionallength: number

      length of the slice.

    Returns pl.Series<any, string>

  • Sort this Series.

    Returns pl.Series<any, string>

    since 0.16.0

    descending

    s = pl.Series("a", [1, 3, 4, 2])
    s.sort()
    shape: (4,)
    Series: 'a' [i64]
    [
    1
    2
    3
    4
    ]
    s.sort({descending: true})
    shape: (4,)
    Series: 'a' [i64]
    [
    4
    3
    2
    1
    ]
  • Parameters

    • options: {
          descending?: boolean;
          nullsLast?: boolean;
      }
      • Optionaldescending?: boolean
      • OptionalnullsLast?: boolean

    Returns pl.Series<any, string>

  • Parameters

    • options: {
          nullsLast?: boolean;
          reverse?: boolean;
      }
      • OptionalnullsLast?: boolean
      • Optionalreverse?: boolean

    Returns pl.Series<any, string>

  • Reduce this Series to the sum value.

    Returns number

    > s = pl.Series("a", [1, 2, 3])
    > s.sum()
    6
  • Get last N elements as Series.


    Parameters

    • Optionallength: number

      Length of the tail

    Returns pl.Series<any, string>

    head

    s = pl.Series("a", [1, 2, 3])
    s.tail(2)
    shape: (2,)
    Series: 'a' [i64]
    [
    2
    3
    ]
  • Convert this Series to a Javascript Array.

    This operation clones data, and is very slow, but maintains greater precision for all dtypes. Often times series.toObject().values is faster, but less precise


    Returns DTypeToJs<T>[]

    const s = pl.Series("a", [1, 2, 3])
    const arr = s.toArray()
    [1, 2, 3]
    Array.isArray(arr)
    true
  • Get dummy/indicator variables.

    Parameters

    • Optionalseparator: string
    • OptionaldropFirst: boolean

    Returns pl.DataFrame<any>

    const s = pl.Series("a", [1, 2, 3])
    >>> s.toDummies()
    shape: (3, 3)
    ┌─────┬─────┬─────┐
    a_1a_2a_3
    │ --- ┆ --- ┆ --- │
    u8u8u8
    ╞═════╪═════╪═════╡
    100
    010
    001
    └─────┴─────┴─────┘

    >>> s.toDummies(":", true)
    shape: (3, 2)
    ┌─────┬─────┐
    a:2a:3
    │ --- ┆ --- │
    u8u8
    ╞═════╪═════╡
    00
    10
    01
    └─────┴─────┘
  • Returns a Javascript object representation of Series Often this is much faster than the iterator, or values method

    Returns {
        datatype: DtypeToJsName<T>;
        name: Name;
        values: DTypeToJs<T>[];
    }

    • datatype: DtypeToJsName<T>
    • name: Name
    • values: DTypeToJs<T>[]
    const s = pl.Series("foo", [1,2,3])
    s.toObject()
    {
    name: "foo",
    datatype: "Float64",
    values: [1,2,3]
    }
  • Converts series to a javascript typedArray.

    Warning: This will throw an error if you have nulls, or are using non numeric data types

    Returns any

  • Get unique elements in series.


    Parameters

    • OptionalmaintainOrder: boolean | {
          maintainOrder: boolean;
      }

      Maintain order of data. This requires more work.

    Returns pl.Series<any, string>

    s = pl.Series("a", [1, 2, 2, 3])
    s.unique()
    shape: (3,)
    Series: 'a' [i64]
    [
    1
    2
    3
    ]
  • Count the unique values in a Series.

    Parameters

    • Optionalsort: boolean

      Sort the output by count in descending order. If set to False (default), the order of the output is random.

    • Optionalparallel: boolean

      Execute the computation in parallel. .. note:: This option should likely not be enabled in a group by context, as the computation is already parallelized per group.

    • Optionalname: string

      Give the resulting count column a specific name; if normalize is True defaults to "count", otherwise defaults to "proportion".

    • Optionalnormalize: boolean

      If true gives relative frequencies of the unique values


    Returns pl.DataFrame<any>

    s = pl.Series("a", [1, 2, 2, 3])
    s.valueCounts()
    shape: (3, 2)
    ╭─────┬────────╮
    acounts
    │ --- ┆ --- │
    i64u32
    ╞═════╪════════╡
    22
    ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
    11
    ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
    31
    ╰─────┴────────╯
  • Returns an iterator over the values

    Returns IterableIterator<any, any, any>

  • Where mask evaluates true, take values from self.

    Where mask evaluates false, take values from other.


    Parameters

    • mask: pl.Series<any, string>

      Boolean Series

    • other: pl.Series<any, string>

      Series of same type

    Returns pl.Series<any, string>

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.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

  • 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.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

  • Compute a rolling median

    Parameters

    Returns pl.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

  • 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.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

  • Compute a rolling quantile

    Parameters

    Returns pl.Series<T, string>

  • Parameters

    • quantile: number
    • Optionalinterpolation: InterpolationMethod
    • OptionalwindowSize: number
    • Optionalweights: number[]
    • OptionalminPeriods: number[]
    • Optionalcenter: boolean
    • Optionalby: string
    • Optionalclosed: ClosedWindow

    Returns pl.Series<T, string>

  • 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.Series<T, string>

  • Compute a rolling skew

    Parameters

    Returns pl.Series<T, string>

  • 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.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

  • 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.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>

  • 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.Series<T, string>

  • Parameters

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

    Returns pl.Series<T, string>