nxcals.api.extraction.data.builders.DataFrame.cube
- DataFrame.cube(*cols: ColumnOrName) GroupedData
- DataFrame.cube(__cols: Union[List[Column], List[str]]) GroupedData
Create a multi-dimensional cube for the current
DataFrame
using the specified columns, so we can run aggregations on them.New in version 1.4.0.
Examples
>>> df.cube("name", df.age).count().orderBy("name", "age").show() +-----+----+-----+ | name| age|count| +-----+----+-----+ | null|null| 2| | null| 2| 1| | null| 5| 1| |Alice|null| 1| |Alice| 2| 1| | Bob|null| 1| | Bob| 5| 1| +-----+----+-----+