Ducklings API Documentation
    Preparing search index...

    Interface Table<T>

    A table consists of a collection of named columns (or 'children'). To work with table data directly in JavaScript, use toColumns() to extract an object that maps column names to extracted value arrays, or toArray() to extract an array of row objects. For random access by row index, use getChild() to access data for a specific column.

    interface Table<T extends TypeMap = TypeMap> {
        children: Column<any>[];
        factory: StructFactory;
        names: (keyof T)[];
        schema: Schema;
        get "[toStringTag]"(): string;
        get numCols(): number;
        get numRows(): number;
        "[iterator]"(): Generator<
            { [P in string
            | number
            | symbol]: T[P] },
            any,
            any,
        >;
        at(index: number): { [P in string | number | symbol]: T[P] };
        get(index: number): { [P in string | number | symbol]: T[P] };
        getChild<P extends string | number | symbol>(name: P): Column<T[P]>;
        getChildAt<R extends any>(index: number): Column<R>;
        select<K extends string | number | symbol>(
            names: K[],
            as?: string[],
        ): Table<{ [key: string]: T[keyof T] }>;
        selectAt<V extends any>(
            indices: number[],
            as?: string[],
        ): Table<{ [key: string]: V }>;
        toArray(): { [P in string | number | symbol]: T[P] }[];
        toColumns(): { [P in string | number | symbol]: ValueArray<T[P]> };
    }

    Type Parameters

    • T extends TypeMap = TypeMap
    Index

    Properties

    children: Column<any>[]
    factory: StructFactory
    names: (keyof T)[]
    schema: Schema

    Accessors

    • get "[toStringTag]"(): string

      Provide an informative object string tag.

      Returns string

    • get numCols(): number

      The number of columns in this table.

      Returns number

      The number of columns.

    • get numRows(): number

      The number of rows in this table.

      Returns number

      The number of rows.

    Methods

    • Return an iterator over objects representing the rows of this table.

      Returns Generator<{ [P in string | number | symbol]: T[P] }, any, any>

    • Return a row object for the given index.

      Parameters

      • index: number

        The row index.

      Returns { [P in string | number | symbol]: T[P] }

      The row object.

    • Return a row object for the given index. This method is the same as at() and is provided for better compatibility with Apache Arrow JS.

      Parameters

      • index: number

        The row index.

      Returns { [P in string | number | symbol]: T[P] }

      The row object.

    • Return the first child column with the given name.

      Type Parameters

      • P extends string | number | symbol

      Parameters

      • name: P

        The column name.

      Returns Column<T[P]>

    • Return the child column at the given index position.

      Type Parameters

      • R extends any

      Parameters

      • index: number

        The column index.

      Returns Column<R>

    • Construct a new table containing only columns with the specified names. If columns have duplicate names, the first (with lowest index) is used. The order of columns in the new table matches the order of input names.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • names: K[]

        Names of columns to keep.

      • Optionalas: string[]

        Optional new names for selected columns.

      Returns Table<{ [key: string]: T[keyof T] }>

      A new table with columns matching the specified names.

    • Construct a new table containing only columns at the specified indices. The order of columns in the new table matches the order of input indices.

      Type Parameters

      • V extends any

      Parameters

      • indices: number[]

        The indices of columns to keep.

      • Optionalas: string[]

        Optional new names for selected columns.

      Returns Table<{ [key: string]: V }>

      A new table with selected columns.

    • Return an array of objects representing the rows of this table.

      Returns { [P in string | number | symbol]: T[P] }[]

    • Return an object mapping column names to extracted value arrays.

      Returns { [P in string | number | symbol]: ValueArray<T[P]> }