Skip to content

Function: toTable() ​

ts
function toTable(data): Table;

Normalize any DataInput into a Table.

  • Rows ([{ a: 1, b: 'x' }, …]): columns are the keys of all rows, in first-seen order; a row without a key has undefined there.
  • Columns ({ a: [...], b: [...] }): typed arrays are copied into plain arrays; all columns must be equally long.
  • Arrow tables (anything with numRows, schema.fields and getChild(name)): one column per schema field; bigints become numbers.
  • A Table is returned as is; null / undefined give an empty table (then every column must be given as an array in the options, as px allows).

Parameters ​

ParameterType
dataDataInput | null | undefined

Returns ​

Table

Throws ​

For other inputs and for columns of different lengths.

Released under the MIT License.