Skip to content

Fix Time_period cast to String does not follow the time_period_output_format #635

@mla2001

Description

@mla2001

Initial Checks

Summary

Time_period cast to String shows the Time_Period internal representation as string instead of the time_period_output_format.

Reproducible Example

script = """
        DS_str := DS_1[calc Me_2 := cast(Me_1, string)];
        DS_filtered := DS_str[filter Me_2 = "2021"];
        Data_in_2022 <- DS_filtered[drop Me_2];
    """

    data_structures = {
        "datasets": [
            {
                "name": "DS_1",
                "DataStructure": [
                    {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": False},
                    {"name": "Me_1", "type": "Time_Period", "role": "Measure", "nullable": True},
                ],
            }
        ]
    }

    data_df = pd.DataFrame({"Id_1": [1, 2, 3], "Me_1": ["2020", "2021", "2022"]})

    datapoints = {"DS_1": data_df}

    run_result = run(
        script=script,
        data_structures=data_structures,
        datapoints=datapoints,
        time_period_output_format="natural",
    )

vtlengine version

1.6.2

Python version

Any

OS

Any

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions