Interface Series

A Series represents a single column in a polars DataFrame.

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

Hierarchy

Properties

date: SeriesDateFunctions
dtype: DataType
lst: ListNamespace
name: string
str: StringNamespace
struct: SeriesStructFunctions

Methods - Arithmetic

Methods - Comparison

  • Compare self to other: self >= other

    Parameters

    • other: any

    Returns pl.Series

Methods - Cumulative

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

    Parameters

    • Optional reverse: boolean

    Returns pl.Series

  • Parameters

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

    Returns pl.Series

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


    Parameters

    • Optional reverse: boolean

      reverse the operation

    Returns pl.Series

    Example

    >  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

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


    Parameters

    • Optional reverse: boolean

      reverse the operation

    Returns pl.Series

    Example

    >  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

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


    Parameters

    • Optional reverse: boolean

      reverse the operation

    Returns pl.Series

    Example

    >  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

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


    Parameters

    • Optional reverse: boolean

      reverse the operation

    Returns pl.Series

    Example

    >  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

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

  • 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

  • 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

  • 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

  • Parameters

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

    Returns pl.Series

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

    Parameters

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

    Returns pl.Series

    Example

    > 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

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

    Returns pl.Series

  • Parameters

    • Optional n: number
    • Optional frac: number
    • Optional withReplacement: boolean
    • Optional seed: number | bigint

    Returns pl.Series

Methods - Other

  • Returns IterableIterator<any>

  • Append a Series to this one.


    Parameters

    Returns void

    Example

    >  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>

  • Get the length of each individual chunk

    Returns any[]

  • __Quick summary statistics of a series. __

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


    Returns pl.DataFrame

    Example

    >  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

  • Parameters

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

    Returns pl.Series

  • Compute the dot/inner product between two Series


    Parameters

    Returns undefined | null | number

    Example

    >  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

    Expr that evaluates to a float 64 Series.

    Examples

    > 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

    • Optional alpha: number
    • Optional adjust: boolean
    • Optional minPeriods: number
    • Optional bias: boolean
    • Optional ignoreNulls: boolean

    Returns pl.Series

  • Parameters

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

    Returns pl.Series

  • Exponentially-weighted standard deviation.

    Returns pl.Series

    Expr that evaluates to a float 64 Series.

    Examples

    > 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

    • Optional alpha: number
    • Optional adjust: boolean
    • Optional minPeriods: number
    • Optional bias: boolean
    • Optional ignoreNulls: boolean

    Returns pl.Series

  • Parameters

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

    Returns pl.Series

  • Exponentially-weighted variance.

    Returns pl.Series

    Expr that evaluates to a float 64 Series.

    Examples

    > 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

    • Optional alpha: number
    • Optional adjust: boolean
    • Optional minPeriods: number
    • Optional bias: boolean
    • Optional ignoreNulls: boolean

    Returns pl.Series

  • Parameters

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

    Returns pl.Series

  • Explode a list or utf8 Series.

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


    Returns any

    Example

    >  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

    Deprecated

    See

    extendConstant

  • 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

  • Fill null values with a filling strategy.


    Parameters

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

      Filling Strategy

    Returns pl.Series

    Example

    >  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

  • Take values by index.


    Parameters

    • indices: number[]

      Index location used for the selection

    Returns pl.Series

    Example

    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

    • Optional offset: number

      Start the row count at this offset

    Returns pl.Series

    Example

    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
    ]
  • Returns True if the Series has a validity bitmask. If there is none, it means that there are no null values.

    Returns boolean

  • Hash the Series The hash value is of type UInt64


    Parameters

    • Optional k0: number | bigint

      seed parameter

    • Optional k1: number | bigint

      seed parameter

    • Optional k2: number | bigint

      seed parameter

    • Optional k3: number | bigint

      seed parameter

    Returns pl.Series

    Example

    >  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;
      }
      • Optional k0?: number | bigint
      • Optional k1?: number | bigint
      • Optional k2?: number | bigint
      • Optional k3?: number | bigint

    Returns pl.Series

  • Get first N elements as Series.


    Parameters

    • Optional length: number

      Length of the head

    Returns pl.Series

    Example

    >  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

    Example

    >  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

    Example

    >  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

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

    Returns pl.Series

    Example

    >  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

    Example

    >  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

    Example

    >  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

    Example

    >  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

    Deprecated

    since 0.8.4

    See

    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
    • Optional bias: boolean

    Returns Optional<number>

  • Parameters

    • __namedParameters: {
          bias?: boolean;
          fisher?: boolean;
      }
      • Optional bias?: boolean
      • Optional fisher?: boolean

    Returns Optional<number>

  • Length of this Series.


    Returns number

    Example

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


    Parameters

    • Optional n: number

      Amount of elements to take.

    Returns pl.Series

    See

    head

    Example

    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

    Example

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

    Returns number

    Example

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

    Returns number

    Example

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

    Returns number

    Example

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


    Returns pl.Series

    Example

    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 number of unique values in this Series.


    Returns number

    Example

    s = pl.Series("a", [1, 2, 2, 3])
    s.nUnique()
    3
  • Count the null values in this Series. -- undefined values are treated as null

    Returns number

  • Get a boolean mask of the local maximum peaks.


    Returns pl.Series

    Example

    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

    Example

    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
    • Optional interpolation: string

    Returns number

    Example

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

    Parameters

    • Optional method: RankMethod

      The method used to assign ranks to tied elements. The following methods are available: default is 'average'

      • 'average': The average of the ranks that would have been assigned to all the tied values is assigned to each value.
      • 'min': The minimum of the ranks that would have been assigned to all the tied values is assigned to each value. This is also referred to as "competition" ranking.
      • 'max': The maximum of the ranks that would have been assigned to all the tied values is assigned to each value.
      • 'dense': Like 'min', but the rank of the next highest element is assigned the rank immediately after those assigned to the tied elements.
      • 'ordinal': All values are given a distinct rank, corresponding to the order that the values occur in a.
      • 'random': Like 'ordinal', but the rank for ties is not dependent on the order that the values occur in a.

    Returns pl.Series

  • 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

    • Optional signed: boolean

      signed or unsigned

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

    Returns pl.Series

    See

    cast

  • Rename this Series.

    Parameters

    • name: string

      new name

    Returns pl.Series

    See

    alias

    Example

    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;
      }
      • Optional inPlace?: 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

      Series to compare with.

    • Optional nullEqual: boolean

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


    • Optional strict: boolean

    Returns boolean

    Example

    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

    • indices: pl.Series | number[]
    • value: any

      value to replace masked values with

    Returns void

    Deprecated

    Since

    0.8.4

    Use

    scatter

  • 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

    Example

    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

  • Parameters

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

    Returns pl.Series

  • 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

    • Optional bias: boolean

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

    Returns undefined | number

  • Create subslices of the Series.

    Parameters

    • start: number
    • Optional length: number

      length of the slice.

    Returns pl.Series

  • Sort this Series.

    Returns pl.Series

    Example

    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;
      }
      • Optional descending?: boolean
      • Optional nullsLast?: boolean

    Returns pl.Series

  • Reduce this Series to the sum value.

    Returns number

    Example

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


    Parameters

    • Optional length: number

      Length of the tail

    Returns pl.Series

    See

    head

    Example

    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 any[]

    Example

    const s = pl.Series("a", [1, 2, 3])
    const arr = s.toArray()
    [1, 2, 3]
    Array.isArray(arr)
    true
  • Returns a Javascript object representation of Series Often this is much faster than the iterator, or values method

    Returns {
        datatype: string;
        name: string;
        values: any[];
    }

    • datatype: string
    • name: string
    • values: any[]

    Example

    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

    • Optional maintainOrder: boolean | {
          maintainOrder: boolean;
      }

      Maintain order of data. This requires more work.

    Returns pl.Series

    Example

    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

    • Optional sort: boolean

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


    Returns pl.DataFrame

    Example

    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>

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

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean

    Returns pl.Series

  • 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

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean

    Returns pl.Series

  • Compute a rolling median

    Parameters

    Returns pl.Series

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean

    Returns pl.Series

  • 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

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean

    Returns pl.Series

  • Compute a rolling skew

    Parameters

    • windowSize: number

      Size of the rolling window

    • Optional bias: boolean

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

    Returns pl.Series

  • Compute a rolling skew

    Parameters

    Returns pl.Series

  • 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

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean
    • Optional ddof: number

    Returns pl.Series

  • 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

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean

    Returns pl.Series

  • 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

  • Parameters

    • windowSize: number
    • Optional weights: number[]
    • Optional minPeriods: number[]
    • Optional center: boolean
    • Optional ddof: number

    Returns pl.Series