← aggr operator page · clause/aggr/group_except/manual_ex_2
pandas ✅ · DuckDB ✅
aggr Me_3 := min( Me_1 ) group except Id_3, over an Integer measure.
Aggregation, Example 2, output verbatim: "group except: the Data Points are grouped by the values of the Identifiers not specified as groupingId. The Identifiers specified as groupingId are dropped in the result."
Id_1, Id_2 and the smallest Me_1 of each group, 0, 3 and 2. Me_3 stays an Integer, as the manual's ex_2.json writes it: unlike sum, min allows no other type, as Minimun value says "For numeric operands, the result has the same type as the operand".
DS_r := DS_1 [ aggr Me_3:= min( Me_1 ) group except Id_3 ];
| Id_1 | Id_2 | Id_3 | Me_1 |
|---|---|---|---|
| 1 | A | XX | 0 |
| 1 | A | YY | 2 |
| 1 | B | XX | 3 |
| 1 | B | YY | 5 |
| 2 | A | XX | 7 |
| 2 | A | YY | 2 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_3 |
|---|---|---|
| 1 | A | 0 |
| 1 | B | 3 |
| 2 | A | 2 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_3", "type": "Integer", "role": "Measure"}
]
}
]
}