← count operator page · aggregate/count/ds_group_by/manual_ex_1
pandas ✅ · DuckDB ✅
count at data set level grouped by Id_1, over one String measure.
Counting the number of data points, Example 1, output verbatim: "The operator returns the number of the input Data Points." The result type is dataset { measure<integer> int_var }.
int_var = 3 for 2011 and 2 for 2012. With one measure and no null, #1049 gives the same output.
DS_r := count ( DS_1 group by Id_1 );
| Id_1 | Id_2 | Id_3 | Me_1 |
|---|---|---|---|
| 2011 | A | XX | iii |
| 2011 | A | YY | jjj |
| 2011 | B | YY | iii |
| 2012 | A | XX | kkk |
| 2012 | B | YY | iii |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "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": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | int_var |
|---|---|
| 2011 | 3 |
| 2012 | 2 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
{"name": "int_var", "type": "Integer", "role": "Measure"}
]
}
]
}