Skip to main content

Group By

Group and aggregate the data.

Group and aggregate the data

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
I/O
byList of the input columns to group on.string, array[]No
Options
listGroup and return all values for these column(s) as a list.string, array—No
firstThe first value for these column(s).string, array—No
lastThe last value for these column(s).string, array—No
minThe minimum value for these column(s).string, array—No
maxThe maximum value for these column(s).string, array—No
meanThe mean (average) value for these column(s).string, array—No
medianThe median value for these column(s).string, array—No
nuniqueThe count of unique values for these column(s).string, array—No
countThe count of values for these column(s).string, array—No
countsReturn a dictionary containing the count of each distinct value for these column(s). Keys are converted to JSON-safe strings; missing values use the key "null" and booleans use lowercase "true"/"false".string, array—No
stdThe standard deviation of values for these column(s).string, array—No
sumThe total of values for these column(s).string, array—No
anyReturn true if any of the values for these column(s) are true.string, array—No
allReturn true if all of the values for these column(s) are true.string, array—No
p75Get a percentile. Note, you can use any integer here for the corresponding percentile.string, array—No
custom.*Placeholder for custom functions. Replace 'placeholder' with the name of the function.string, array—No
Formatting
auto_rename_columnsIf true (default), aggregated column names include the operation as a suffix (e.g. Value.sum). If false, column names are left as-is; use a dictionary entry to supply a custom output name (e.g. - Value: Total).booleantrueNo
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name.array, object—No

Examples​

wrangles:
- select.group_by:
by:
- Product Type
sum: Quantity
mean: Price ($)
ProductQuantityPrice ($)Product Type
Hammer312.99Hand Tools
Ratchet Wrench126.99Hand Tools
Cordless Drill249.99Power Tools
Reciprocating Saw729.99Power Tools
Product TypeQuantity.sumPrice ($).mean
Hand Tools159.99
Power Tools939.99
wrangles:
- select.group_by:
by: Category
custom.sum_times_two: Quantity
CategoryQuantity
Hand Tools3
Hand Tools1
Hand Tools2
Power Tools4
CategoryQuantity.sum_times_two
Hand Tools12
Power Tools4
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID52
Catalog keyselect.group_by
Recipe keyselect.group_by
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespaceselect
Documentation groupselect
AliasesNone
Runtime symbolwrangles.recipe_wrangles.select.group_by
Legacy UUIDc0af10b1-423a-416c-8cb5-7e7fe1164964

Sources