aggregatenode properties

Aggregate node icon The Aggregate node replaces a sequence of input records with summarized, aggregated output records.

Example

dataasset = modeler.script.stream().create("dataassetimport", "My dataassetimport node")
node = modeler.script.stream().create("aggregate", "My aggregate node")
modeler.script.stream().link(dataasset, node)
node.setPropertyValue("contiguous", True)
node.setPropertyValue("keys", ["Drug"])
node.setKeyedPropertyValue("aggregates", "Age", ["Sum", "Mean"])
Table 1. aggregatenode properties
aggregatenode properties Data type Property description
keys list Lists fields that can be used as keys for aggregation. For example, if Sex and Region are your key fields, each unique combination of M and F with regions N and S (four unique combinations) will have an aggregated record.
contiguous flag Select this option if you know that all records with the same key values are grouped together in the input (for example, if the input is sorted on the key fields). Doing so can improve performance.
aggregates   Structured property listing the numeric fields whose values will be aggregated, as well as the selected modes of aggregation.
aggregate_exprs   Keyed property which keys the derived field name with the aggregate expression used to compute it. For example:
aggregatenode.setKeyedPropertyValue
("aggregate_exprs", "Na_MAX", "MAX('Na')")
extension string Specify a prefix or suffix for duplicate aggregated fields (sample below).
add_as Suffix
Prefix
 
inc_record_count flag Creates an extra field that specifies how many input records were aggregated to form each aggregate record.
count_field string Specifies the name of the record count field.
allow_approximation Boolean Allows approximation of order statistics when aggregation is performed in SPSS Analytic Server.
bin_count integer Specifies the number of bins to use in approximation
aggregate_defaults Mean
Sum
Min
Max
SDev
Median
Count
Variance
FirstQuartile
ThirdQuartile
Specify the field aggregation mode to use for newly added fields.