Skip to content

Fix metrics_to_dataframe function #183

Closed
@kzscisoft

Description

@kzscisoft

Testing of the metrics_to_dataframe function fails with errors in the form:

ValueError: 'X' columns passed, passed data had 'Y' columns

This was picked up during testing of the new client.py refactor #181, I wrote a test to check the converter and the same error appeared:

import pytest
import random
import typing
import simvue.converters as sv_conf

try:
    import pandas
except ImportError:
    pandas = None


@pytest.mark.converters
@pytest.mark.parametrize(
    "xaxis", ("step", "time", "timestamp"),
)
@pytest.mark.parametrize(
    "name", (None, "values")
)
@pytest.mark.skipif(not pandas, reason="Pandas not installed")
def test_metrics_to_dataframe(xaxis: str, name: typing.Optional[str]) -> None:
    ROWS: int = 100
    COLUMNS: int = 10
    TEST_METRICS: list[list[float]] = [
        [random.random() for _ in range(COLUMNS)]
        for _ in range(ROWS)
    ]
    sv_conf.metrics_to_dataframe(
        data=TEST_METRICS,
        xaxis=xaxis,
        name=name
    )

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions