Top-Level | Data Types | Schema | Table | Column |
A table consists of named data columns (or ‘children’). To extract table data directly to JavaScript values, use toColumns()
to produce an object that maps column names to extracted value arrays, or toArray()
to extract an array of row objects. Tables are iterable, iterating over row objects. While toArray()
and table iterators enable convenient use by tools that expect row objects, column-oriented processing is more efficient and thus recommended. Use getChild
or getChildAt
to access a specific Column
.
# Table.constructor(schema, children[, useProxy])
Create a new table with the given schema and children columns. The column types and order must be consistent with the given schema. The tableFromArrays
and tableFromColumns
methods provide more convenient ways to construct a table.
Schema
): The table schema.Column[]
): The table columns.boolean
): Flag indicating if zero-copy row proxy objects should be used to represent table rows instead of standard JavaScript objects (default false
). Proxy objects can improve performance and reduce memory usage, but do not support convenient property enumeration (Object.keys
, Object.values
, Object.entries
) or spreading ({ ...object }
). A proxy object can be converted to a standard object by calling its toJSON()
method.# Table.numCols
The number of columns in the table.
# Table.numRows
The number of rows in the table.
# Table.getChildAt(index)
Return the child column at the given index position.
number
): The column index.# Table.getChild(name)
Return the first child column with the given name.
string
): The column name.# Table.selectAt(indices[, as])
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.
number[]
): The indices of columns to keep.string[]
): Optional new names for the selected columns.# Table.select(names[, as])
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.
string[]
): The names of columns to keep.string[]
): Optional new names for selected columns.# Table.at(index)
Return a row object for the given index. The type of object (standard object or row proxy object) is determined by the table useProxy
constructor argument. The property values of the object are determined by the column data types and extraction options; see the data types documentation for more.
number
): The row index.# Table.get(index)
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.
# Table.toColumns()
Return an object that maps column names to extracted value arrays. The values in each array are determined by the column data types and extraction options; see the data types documentation for more.
# Table.toArray()
Return an array of objects representing the rows of this table. The type of object (standard object or row proxy object) is determined by the table useProxy
constructor argument. The property values of the object are determined by the column data types and extraction options; see the data types documentation for more.
# Table[Symbol.iterator]()
Return an iterator over row objects representing the rows of this table. The type of object (standard object or row proxy object) is determined by the table useProxy
constructor argument. The property values of the object are determined by the column data types and extraction options; see the data types documentation for more.