Simple table constructors
This cheat sheet shows the basic ways to create a table:
- From column data
- With a set number of rows
- As a time table, which adds rows on a timer
- As a ring table, which keeps the latest rows of another table
- As an input table, which accepts new rows
It ends with how to add formula columns to a new table.
new_table
new_table creates a table from supplied column data.
Create columns with the following functions:
bool_colbyte_colchar_coldatetime_coldouble_colfloat_colint_coljobj_collong_colpyobj_colshort_colstring_col
new_table also accepts a dictionary that maps column names to data. In that case, pandas infers the column types, so Integers becomes a long column rather than the int column that int_col creates.
Array columns
The column functions listed above cannot create typed array columns, where each cell holds an array of a given element type. (jobj_col can hold arrays, but only in an Object column.) To create one, pass InputColumn an array column type, such as dtypes.int32_array. Then build each cell with dtypes.array. It takes the element type, such as dtypes.int32, and a sequence such as a NumPy array, and returns a Java array.
empty_table
empty_table creates a table with a given number of rows and no columns. Add columns to it with update, as shown in Add formula columns.
time_table
time_table creates a table that adds a new row at a regular interval.
ring_table
ring_table creates a table that keeps only the latest rows added to a parent table, up to a given capacity. Ring tables are most useful with blink tables, which keep only the rows from the latest update cycle.

input_table
input_table creates an in-memory table that users can add rows to. It starts from either an existing table or a set of column definitions, such as a dictionary that maps each column name to a type from deephaven.dtypes. Without key_cols, the result is append-only: new rows go to the end, and rows cannot be edited or deleted. Pass key_cols to create a keyed input table, which adds, replaces, or deletes rows by key.
Add formula columns
After creating a table, add columns calculated from its existing columns by passing a formula to update. A formula can combine columns, built-in functions such as sqrt, variables, and Python functions. The type hints on f tell Deephaven that it returns a Python int, which Deephaven stores as a Java long. Without a return type hint, the function returns a PyObject, which the formula cannot add to the other terms.
Related documentation
- Create static tables
- Select and create columns
- Formulas
- Work with arrays
- Built-in functions
- Query scope
- Python functions
- Handle PyObjects in tables
- Convert between Deephaven tables and pandas DataFrames
- Create a time table
- Create a ring table
- Create and use input tables
deephaven.dtypesempty_tableinput_tableInputColumnint_colnew_tablering_tablesqrtstring_coltime_tableupdatedtypes.arrayPydoc