ungroup

ungroup ungroups column content. It is the opposite of the group_by method. ungroup expands columns containing either Deephaven arrays or Java arrays into columns of singular values.

Caution

Arrays of different lengths within a row result in an error.

Syntax

Parameters

ParameterTypeDescription
cols optionalUnion[str, list[str]]

The column(s) of data to ungroup.

  • [] all array columns from the source table will be expanded (default).
  • ["X"] will expand column X.
  • ["X", "Y"] will expand columns X and Y.

Returns

A new table in which array columns from the source table are expanded into separate rows.

Examples

In this example, group_by returns an array of values for each column, as grouped by X. ungroup will undo this operation and all array columns from the source table are expanded into separate rows.

In this example, group_by returns an array of values for each column, as grouped by X, while ungroup will expand the created array Y so each element is a new row.