Interface DataFrameConstructor

DataFrame constructor

interface DataFrameConstructor {
    deserialize(buf: Buffer, format: "json" | "bincode"): pl.DataFrame<any>;
    isDataFrame(arg: any): arg is pl.DataFrame<any>;
    (): pl.DataFrame<any>;
    <T1>(data: T1, options?: DataFrameOptions): pl.DataFrame<{
        [K in pl.Series<any, string> as K["name"]]: K
    }>;
    <T2>(data: T2, options?: DataFrameOptions): pl.DataFrame<{
        [K in string | number | symbol]: K extends string
            ? pl.Series<JsToDtype<T2[K<K>][number]>, K<K>>
            : never
    }>;
    (data: any, options?: DataFrameOptions): pl.DataFrame<any>;
}

Hierarchy

  • Create an empty DataFrame

    Returns pl.DataFrame<any>

  • Create a DataFrame from a JavaScript object

    Type Parameters

    • T1 extends ArrayLike<pl.Series<any, string>>

    Parameters

    • data: T1

      object or array of data

    • Optionaloptions: DataFrameOptions

      options

    Returns pl.DataFrame<{
        [K in pl.Series<any, string> as K["name"]]: K
    }>

    data = {'a': [1n, 2n], 'b': [3, 4]}
    df = pl.DataFrame(data)
    df
    shape: (2, 2)
    ╭─────┬─────╮
    ab
    │ --- ┆ --- │
    u64i64
    ╞═════╪═════╡
    13
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    24
    ╰─────┴─────╯
  • Type Parameters

    • T2 extends Record<string, ArrayLike<any>>

    Parameters

    • data: T2
    • Optionaloptions: DataFrameOptions

    Returns pl.DataFrame<{
        [K in string | number | symbol]: K extends string
            ? pl.Series<JsToDtype<T2[K<K>][number]>, K<K>>
            : never
    }>

  • Parameters

    • data: any
    • Optionaloptions: DataFrameOptions

    Returns pl.DataFrame<any>

Methods