aggregation#
2026-03-11
29 min read time
- class pylibhipdf.aggregation.Aggregation#
Bases:
objectA type of aggregation to perform.
Aggregations are passed to APIs like
aggregate()to indicate what operations to perform. Using a class for aggregations provides a unified API for handling parametrizable aggregations. This class should never be instantiated directly, only via one of the factory functions.For details, see
cudf::aggregation.- __init__(*args, **kwargs)#
- kind(self)#
Get the kind of the aggregation.
- pylibhipdf.aggregation.BitwiseOp#
alias of
bitwise_op
- pylibhipdf.aggregation.CorrelationType#
alias of
correlation_type
- pylibhipdf.aggregation.EWMHistory#
alias of
ewm_history
- class pylibhipdf.aggregation.Kind(*values)#
Bases:
IntEnum- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- classmethod from_bytes(bytes, byteorder='big', *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- is_integer()#
Returns True. Exists for duck type compatibility with float.is_integer.
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- SUM = 0#
- PRODUCT = 2#
- MIN = 3#
- MAX = 4#
- COUNT_VALID = 5#
- COUNT_ALL = 6#
- ANY = 7#
- ALL = 8#
- SUM_OF_SQUARES = 9#
- MEAN = 10#
- M2 = 11#
- VARIANCE = 12#
- STD = 13#
- MEDIAN = 14#
- QUANTILE = 15#
- ARGMAX = 16#
- ARGMIN = 17#
- NUNIQUE = 18#
- NTH_ELEMENT = 19#
- ROW_NUMBER = 20#
- EWMA = 21#
- RANK = 22#
- COLLECT_LIST = 23#
- COLLECT_SET = 24#
- LEAD = 25#
- LAG = 26#
- PTX = 27#
- CUDA = 28#
- HOST_UDF = 29#
- MERGE_LISTS = 30#
- MERGE_SETS = 31#
- MERGE_M2 = 32#
- COVARIANCE = 33#
- CORRELATION = 34#
- TDIGEST = 35#
- MERGE_TDIGEST = 36#
- HISTOGRAM = 37#
- MERGE_HISTOGRAM = 38#
- BITWISE_AGG = 39#
- classmethod __getitem__(name)#
Return the member matching name.
- __init__(*args, **kwds)#
- pylibhipdf.aggregation.RankMethod#
alias of
rank_method
- pylibhipdf.aggregation.RankPercentage#
alias of
rank_percentage
- pylibhipdf.aggregation.UdfType#
alias of
udf_type
- pylibhipdf.aggregation.all() Aggregation#
Create an all aggregation.
For details, see
make_all_aggregation().Returns#
- Aggregation
The all aggregation.
- pylibhipdf.aggregation.any() Aggregation#
Create an any aggregation.
For details, see
make_any_aggregation().Returns#
- Aggregation
The any aggregation.
- pylibhipdf.aggregation.argmax() Aggregation#
Create an argmax aggregation.
For details, see
make_argmax_aggregation().Returns#
- Aggregation
The argmax aggregation.
- pylibhipdf.aggregation.argmin() Aggregation#
Create an argmin aggregation.
For details, see
make_argmin_aggregation().Returns#
- Aggregation
The argmin aggregation.
- pylibhipdf.aggregation.bitwise(bitwise_op op) Aggregation#
Create a bitwise aggregation.
For details, see
make_bitwise_aggregation().Parameters#
- opBitwiseOp
The bitwise operation to perform on the input column
Returns#
- Aggregation
The bitwise aggregation.
- pylibhipdf.aggregation.collect_list(null_policy null_handling=null_policy.INCLUDE) Aggregation#
Create a collect_list aggregation.
For details, see
make_collect_list_aggregation().Parameters#
- null_handlingnull_policy, default INCLUDE
Whether or not nulls should be included.
Returns#
- Aggregation
The collect_list aggregation.
- pylibhipdf.aggregation.collect_set(null_handling=null_policy.INCLUDE, nulls_equal=null_equality.EQUAL, nans_equal=nan_equality.ALL_EQUAL) Aggregation#
Create a collect_set aggregation.
For details, see
make_collect_set_aggregation().Parameters#
- null_handlingnull_policy, default INCLUDE
Whether or not nulls should be included.
- nulls_equalnull_equality, default EQUAL
Whether or not nulls should be considered equal.
- nans_equalnan_equality, default ALL_EQUAL
Whether or not NaNs should be considered equal.
Returns#
- Aggregation
The collect_set aggregation.
- pylibhipdf.aggregation.correlation(correlation_type type, size_type min_periods) Aggregation#
Create a correlation aggregation.
For details, see
make_correlation_aggregation().Parameters#
- typecorrelation_type
The type of correlation to compute.
- min_periodsint
The minimum number of observations to consider for computing the correlation.
Returns#
- Aggregation
The correlation aggregation.
- pylibhipdf.aggregation.count(null_policy null_handling=null_policy.EXCLUDE) Aggregation#
Create a count aggregation.
For details, see
make_count_aggregation().Parameters#
- null_handlingnull_policy, default EXCLUDE
Whether or not nulls should be included.
Returns#
- Aggregation
The count aggregation.
- pylibhipdf.aggregation.covariance(size_type min_periods, size_type ddof) Aggregation#
Create a covariance aggregation.
For details, see
make_covariance_aggregation().Parameters#
- min_periodsint
The minimum number of observations to consider for computing the covariance.
- ddofint
Delta degrees of freedom.
Returns#
- Aggregation
The covariance aggregation.
- pylibhipdf.aggregation.ewma(float center_of_mass, ewm_history history) Aggregation#
Create a EWMA aggregation.
For details, see
make_ewma_aggregation().Parameters#
- center_of_massfloat
The decay in terms of the center of mass
- historyewm_history
Whether or not to treat the history as infinite.
Returns#
- Aggregation
The EWMA aggregation.
- pylibhipdf.aggregation.histogram() Aggregation#
Create a histogram aggregation.
For details, see
make_histogram_aggregation().Returns#
- Aggregation
The histogram aggregation.
- pylibhipdf.aggregation.is_valid_aggregation(DataType source, Aggregation agg) bool#
Return if an aggregation is supported for a given datatype.
Parameters#
- source
The type of the column the aggregation is being performed on.
- agg
The aggregation.
Returns#
True if the aggregation is supported.
- pylibhipdf.aggregation.lag(size_type offset) Aggregation#
Create a lag aggregation.
For details, see
make_lag_aggregation().Parameters#
- offsetint
The number of rows to lag the input
Returns#
- Aggregation
The lag aggregation.
- pylibhipdf.aggregation.lead(size_type offset) Aggregation#
Create a lead aggregation.
For details, see
make_lead_aggregation().Parameters#
- offsetint
The number of rows to lead the input
Returns#
- Aggregation
The lead aggregation.
- pylibhipdf.aggregation.m2() Aggregation#
Create a M2 aggregation.
For details, see
make_m2_aggregation().Returns#
- Aggregation
The M2 aggregation.
- pylibhipdf.aggregation.max() Aggregation#
Create a max aggregation.
For details, see
make_max_aggregation().Returns#
- Aggregation
The max aggregation.
- pylibhipdf.aggregation.mean() Aggregation#
Create a mean aggregation.
For details, see
make_mean_aggregation().Returns#
- Aggregation
The mean aggregation.
- pylibhipdf.aggregation.median() Aggregation#
Create a median aggregation.
For details, see
make_median_aggregation().Returns#
- Aggregation
The median aggregation.
- pylibhipdf.aggregation.merge_histogram() Aggregation#
Create a merge histogram aggregation.
For details, see
make_merge_histogram_aggregation().Returns#
- Aggregation
The merge histogram aggregation.
- pylibhipdf.aggregation.merge_lists() Aggregation#
Create a merge lists aggregation.
For details, see
make_merge_lists_aggregation().Returns#
- Aggregation
The merge lists aggregation.
- pylibhipdf.aggregation.merge_m2() Aggregation#
Create a merge M2 aggregation.
For details, see
make_merge_m2_aggregation().Returns#
- Aggregation
The merge M2 aggregation.
- pylibhipdf.aggregation.merge_sets(null_equality nulls_equal=null_equality.EQUAL, nan_equality nans_equal=nan_equality.ALL_EQUAL) Aggregation#
Create a merge sets aggregation.
For details, see
make_merge_sets_aggregation().Parameters#
- nulls_equalnull_equality, default EQUAL
Whether or not nulls should be considered equal.
- nans_equalnan_equality, default ALL_EQUAL
Whether or not NaNs should be considered equal.
Returns#
- Aggregation
The merge sets aggregation.
- pylibhipdf.aggregation.merge_tdigest(int max_centroids) Aggregation#
Create a merge TDIGEST aggregation.
For details, see
make_merge_tdigest_aggregation().Parameters#
- max_centroidsint
Parameter controlling compression level and accuracy on subsequent queries on the output tdigest data.
Returns#
- Aggregation
The merge TDIGEST aggregation.
- pylibhipdf.aggregation.min() Aggregation#
Create a min aggregation.
For details, see
make_min_aggregation().Returns#
- Aggregation
The min aggregation.
- pylibhipdf.aggregation.nth_element(size_type n, null_policy null_handling=null_policy.INCLUDE) Aggregation#
Create a nth_element aggregation.
For details, see
make_nth_element_aggregation().Parameters#
- null_handlingnull_policy, default INCLUDE
Whether or not nulls should be included.
Returns#
- Aggregation
The nth_element aggregation.
- pylibhipdf.aggregation.nunique(null_policy null_handling=null_policy.EXCLUDE) Aggregation#
Create a nunique aggregation.
For details, see
make_nunique_aggregation().Parameters#
- null_handlingnull_policy, default EXCLUDE
Whether or not nulls should be included.
Returns#
- Aggregation
The nunique aggregation.
- pylibhipdf.aggregation.product() Aggregation#
Create a product aggregation.
For details, see
make_product_aggregation().Returns#
- Aggregation
The product aggregation.
- pylibhipdf.aggregation.quantile(list quantiles, interpolation interp=interpolation.LINEAR) Aggregation#
Create a quantile aggregation.
For details, see
make_quantile_aggregation().Parameters#
- quantileslist
List of quantiles to compute, should be between 0 and 1.
- interpinterpolation, default LINEAR
Interpolation technique to use when the desired quantile lies between two data points.
Returns#
- Aggregation
The quantile aggregation.
- pylibhipdf.aggregation.rank(rank_method method, order column_order=order.ASCENDING, null_policy null_handling=null_policy.EXCLUDE, null_order null_precedence=null_order.AFTER, rank_percentage percentage=rank_percentage.NONE) Aggregation#
Create a rank aggregation.
For details, see
make_rank_aggregation().Parameters#
- methodrank_method
The method to use for ranking.
- column_orderorder, default ASCENDING
The order in which to sort the column.
- null_handlingnull_policy, default EXCLUDE
Whether or not nulls should be included.
- null_precedencenull_order, default AFTER
Whether nulls should come before or after non-nulls.
- percentagerank_percentage, default NONE
Whether or not ranks should be converted to percentages, and if so, the type of normalization to use.
Returns#
- Aggregation
The rank aggregation.
- pylibhipdf.aggregation.row_number() Aggregation#
Create a row_number aggregation.
For details, see
make_row_number_aggregation().Returns#
- Aggregation
The row_number aggregation.
- pylibhipdf.aggregation.std(size_type ddof=1) Aggregation#
Create a std aggregation.
For details, see
make_std_aggregation().Parameters#
- ddofint, default 1
Delta degrees of freedom. The default value is 1.
Returns#
- Aggregation
The std aggregation.
- pylibhipdf.aggregation.sum() Aggregation#
Create a sum aggregation.
For details, see
make_sum_aggregation().Returns#
- Aggregation
The sum aggregation.
- pylibhipdf.aggregation.sum_of_squares() Aggregation#
Create a sum_of_squares aggregation.
For details, see
make_sum_of_squares_aggregation().Returns#
- Aggregation
The sum_of_squares aggregation.
- pylibhipdf.aggregation.tdigest(int max_centroids) Aggregation#
Create a TDIGEST aggregation.
For details, see
make_tdigest_aggregation().Parameters#
- max_centroidsint
Parameter controlling compression level and accuracy on subsequent queries on the output tdigest data.
Returns#
- Aggregation
The TDIGEST aggregation.
- pylibhipdf.aggregation.udf(unicode operation, DataType output_type) Aggregation#
Create a udf aggregation.
For details, see
make_udf_aggregation().Parameters#
- operationstr
The operation to perform as a string of PTX code.
- output_typeDataType
The output type of the aggregation.
Returns#
- Aggregation
The udf aggregation.
- pylibhipdf.aggregation.variance(size_type ddof=1) Aggregation#
Create a variance aggregation.
For details, see
make_variance_aggregation().Parameters#
- ddofint, default 1
Delta degrees of freedom.
Returns#
- Aggregation
The variance aggregation.