nodejs-polars
    Preparing search index...

    Interface DataFrameConstructor

    DataFrame constructor

    interface DataFrameConstructor {
        deserialize(buf: Buffer, format: "json" | "bincode"): pl.DataFrame;
        isDataFrame(arg: any): arg is pl.DataFrame<any>;
        (): pl.DataFrame;
        <T1 extends ArrayLike<pl.Series<any, string>>>(
            data: T1,
            options?: DataFrameOptions,
        ): pl.DataFrame<{ [K in pl.Series<any, string> as K["name"]]: K }>;
        <T2 extends Record<string, ArrayLike<any>>>(
            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;
    }

    Hierarchy

    • Create an empty DataFrame

      Returns pl.DataFrame

    • 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

        • columns

          column names

        • orient

          orientation of the data [row, col] Whether to interpret two-dimensional data as columns or as rows. If None, the orientation is inferred by matching the columns and data dimensions. If this does not yield conclusive results, column orientation is used.

        • schema

          The schema of the resulting DataFrame. The schema may be declared in several ways:

          - As a dict of {name:type} pairs; if type is None, it will be auto-inferred.
          
          - As a list of column names; in this case types are automatically inferred.
          
          - As a list of (name,type) pairs; this is equivalent to the dictionary form.
          

          If you supply a list of column names that does not match the names in the underlying data, the names given here will overwrite them. The number of names given in the schema should match the underlying data dimensions.

          If set to null (default), the schema is inferred from the data.

        • schemaOverrides

          Support type specification or override of one or more columns; note that any dtypes inferred from the schema param will be overridden.

        • inferSchemaLength

          The maximum number of rows to scan for schema inference. If set to None, the full data may be scanned (this can be slow). This parameter only applies if the input data is a sequence or generator of rows; other input is read as-is. The number of entries in the schema should match the underlying data dimensions, unless a sequence of dictionaries is being passed, in which case a partial schema can be declared to prevent specific fields from being loaded.

      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

    Index

    Methods