pyarrow.TableGroupBy¶
- class pyarrow.TableGroupBy(table, keys)¶
Bases:
objectA grouping of columns in a table on which to perform aggregations.
- Parameters
- table
pyarrow.Table Input table to execute the aggregation on.
- keys
strorlist[str] Name of the grouped columns.
- table
- __init__(self, table, keys)¶
Methods
__init__(self, table, keys)aggregate(self, aggregations)Perform an aggregation over the grouped columns of the table.
- aggregate(self, aggregations)¶
Perform an aggregation over the grouped columns of the table.
- Parameters
- Returns
TableResults of the aggregation functions.
Examples
>>> t = pa.table([ ... pa.array(["a", "a", "b", "b", "c"]), ... pa.array([1, 2, 3, 4, 5]), ... ], names=["keys", "values"]) >>> t.group_by("keys").aggregate([("values", "sum")]) pyarrow.Table values_sum: int64 keys: string ---- values_sum: [[3,7,5]] keys: [["a","b","c"]]