crandas.groupby#
Crandas groupby functionality
- class crandas.groupby.Aggregator(aggregator)#
Bases:
object
Aggregation functions for use as arguments to CSeriesGRoupBy.agg()
- class crandas.groupby.CDataFrameGroupBy(table, columns, duplicated_size=None, aggregated_size=None, **kwargs)#
Bases:
StateObject
Represents a grouping of a table according to one or more columns
- __getitem__(key)#
Implements [] operator by dispatching to CDataFrameGroupBy.col
- as_table(**query_args)#
Returns a table containing the grouping columns :returns: Table containing the grouping columns :rtype: CDataFrame
- col(col)#
Returns a reference to another grouping grouped according to the grouping
- Parameters:
col (str) – Name of the column
- Returns:
Grouping of the column for use e.g. in aggregation
- Return type:
- classmethod json_to_closed(deferred, json_answer)#
Returns an instance of the class corresponding to to the provided JSON represention.
If the instance comes from a transaction, then deferred is the deferred object originally returned by vdl_query. This function should then check that the returned answer complies with the expected deferred. Otherwise, deferred is None.
- size(**query_args)#
Returns sizes of the groups of the grouping
- Parameters:
query_args (query arguments) –
- Returns:
CDataFrame with column of grouping values and column of counts
- Return type:
CDataFrame/DataFrame
- class crandas.groupby.CSeriesGroupBy(groupby, col)#
Bases:
object
Represents a grouping of a table column according to the values of one or more other columns
- agg(fn, **query_args)#
Aggregate column according to grouping
- Parameters:
fn (Aggregator) – aggregation function to use, e.g., crandas.groupby.sum
- Returns:
CDataFrame containing the grouping columns and an aggregate of the grouped-by column
- Return type:
- crandas.groupby.max = <crandas.groupby.Aggregator object>#
Aggregator that computes the minimum of the given values
- crandas.groupby.sum = <crandas.groupby.Aggregator object>#
Aggregator that computes the maximum of the given values