← period_indicator operator page · time/period_indicator/ds/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

period_indicator(DS_1): the period indicator of the time_period identifier Id_3 of each data point, in the one measure duration_var.

Manual:

Period indicator, Example 1, output verbatim: "The operator returns a Data Set with the same Identifiers of op and one Measure of type duration named duration_var."

Expected:

A for the year 2010 and Q for 2013Q1, which the manual's output writes 2013-Q1, the same period; Me_1 is dropped.

script.vtl ⇩

DS_r := period_indicator ( DS_1 );

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1
A1201010
A12013Q150

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Id_3", "type": "Time_Period", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3duration_var
A12010A
A12013-Q1Q

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier"},
        {"name": "Id_2", "type": "Integer", "role": "Identifier"},
        {"name": "Id_3", "type": "Time_Period", "role": "Identifier"},
        {"name": "duration_var", "type": "Duration", "role": "Measure"}
      ]
    }
  ]
}