← time_agg operator page · time/time_agg/ds/monthly_measure_to_quarters
pandas ✅ · DuckDB ✅
time_agg("Q", DS_1) on a dataset with a monthly time_period measure Me_1 and a quarterly time_period identifier Id_1: the measure is converted, not the identifier.
Time aggregation: "The Data Set version acts on a single Measure Data Set of type time, date or time_period and returns a Data Set having the same structure". Its Additional Constraint asks for "exactly one Identifier" of those types, where VTL 2.1 said "exactly one measure": DS_1 meets both, and the example follows the Behaviour.
2019M02, 2019M11 and 2019M07 go to 2019Q1, 2019Q4 and 2019Q3, the input duration being "inferred from the internal representation of the value"; converting the quarterly Id_1 instead would leave the months in Me_1.
DS_r := time_agg("Q", DS_1);
| Id_1 | Me_1 |
|---|---|
| 2020Q1 | 2019M02 |
| 2020Q2 | 2019M11 |
| 2020Q3 | 2019M07 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Time_Period", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 2020Q1 | 2019Q1 |
| 2020Q2 | 2019Q4 |
| 2020Q3 | 2019Q3 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
{"name": "Me_1", "type": "Time_Period", "role": "Measure"}
]
}
]
}