diff --git a/everviz/pages/deltaplot.py b/everviz/pages/deltaplot.py index 6cc5d29..05aebde 100644 --- a/everviz/pages/deltaplot.py +++ b/everviz/pages/deltaplot.py @@ -21,7 +21,7 @@ def _get_objective_delta_values(api, best_batch): def _get_summary_delta_values(api, best_batch): - summary = api.summary_values() + summary = api.summary_values().to_pandas() if summary.empty: return summary data = ( diff --git a/everviz/pages/summary_values.py b/everviz/pages/summary_values.py index 3ab8384..d6fd436 100644 --- a/everviz/pages/summary_values.py +++ b/everviz/pages/summary_values.py @@ -26,7 +26,7 @@ def _set_up_data_sources(api, keys=None): everviz_path = os.path.join(everest_folder, "everviz") # Make a table which statistics over the realizations. - summary_values = api.summary_values(keys=keys) + summary_values = api.summary_values(keys=keys).to_pandas() if summary_values.empty: return None diff --git a/pyproject.toml b/pyproject.toml index 65f7b07..8f8e244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,8 @@ test = [ "dash[testing]", "pillow", "pytest-mock", - "sphinx" + "sphinx", + "polars" ] style = [ "ruff", diff --git a/tests/integration/delta_plot/test_summary_delta_plot_integration.py b/tests/integration/delta_plot/test_summary_delta_plot_integration.py index 583a822..a7becdf 100644 --- a/tests/integration/delta_plot/test_summary_delta_plot_integration.py +++ b/tests/integration/delta_plot/test_summary_delta_plot_integration.py @@ -1,6 +1,6 @@ from datetime import datetime -import pandas +import polars as pl from everviz.plugins.delta_plot.delta_plot import DeltaPlot from everviz.pages.deltaplot import _get_summary_delta_values @@ -24,7 +24,7 @@ def test_summary_delta_plot_callback(app, dash_duo, mocker, caplog): mock_api = mocker.Mock() - mock_api.summary_values.return_value = pandas.DataFrame(_SUMMARY) + mock_api.summary_values.return_value = pl.DataFrame(_SUMMARY) mocker.patch( "everviz.plugins.delta_plot.delta_plot.get_data", @@ -61,7 +61,7 @@ def test_summary_delta_plot_callback(app, dash_duo, mocker, caplog): def test_summary_delta_plot_empty_callback(app, dash_duo, mocker, caplog): mock_api = mocker.Mock() - mock_api.summary_values.return_value = pandas.DataFrame(_EMPTY_SUMMARY) + mock_api.summary_values.return_value = pl.DataFrame(_EMPTY_SUMMARY) mocker.patch( "everviz.plugins.delta_plot.delta_plot.get_data", diff --git a/tests/unit/test_delta_plot_data.py b/tests/unit/test_delta_plot_data.py index 86058e5..97bc644 100644 --- a/tests/unit/test_delta_plot_data.py +++ b/tests/unit/test_delta_plot_data.py @@ -1,7 +1,7 @@ import os from datetime import datetime -import pandas +import polars as pl from everviz.pages.deltaplot import ( _get_objective_delta_values, @@ -57,7 +57,7 @@ def test_objective_values_data_frame(mocker): def test_summary_values_data_frame(mocker): """Test for the correct layout and size of the objective values data frame.""" mock_api = mocker.Mock() - mock_api.summary_values.return_value = pandas.DataFrame(_SUMMARY) + mock_api.summary_values.return_value = pl.DataFrame(_SUMMARY) summary_delta_values = _get_summary_delta_values(mock_api, 2) @@ -73,7 +73,7 @@ def test_set_up_sources(mocker, tmpdir): mock_api = mocker.Mock() mock_api.objective_values = _OBJECTIVES mock_api.single_objective_values = _SINGLE_OBJECTIVES - mock_api.summary_values.return_value = pandas.DataFrame(_SUMMARY) + mock_api.summary_values.return_value = pl.DataFrame(_SUMMARY) mock_api.output_folder = tmpdir os.mkdir(os.path.join(tmpdir, "everviz")) @@ -92,7 +92,7 @@ def test_delta_plot_layout_with_empty_summary(mocker, tmpdir): mock_api = mocker.Mock() mock_api.objective_values = _OBJECTIVES mock_api.single_objective_values = _SINGLE_OBJECTIVES - mock_api.summary_values.return_value = pandas.DataFrame( + mock_api.summary_values.return_value = pl.DataFrame( {"realization": [], "simulation": [], "date": [], "batch": []} ) mock_api.output_folder = tmpdir diff --git a/tests/unit/test_summary_plot.py b/tests/unit/test_summary_plot.py index 66fceb3..efbc390 100644 --- a/tests/unit/test_summary_plot.py +++ b/tests/unit/test_summary_plot.py @@ -2,6 +2,7 @@ import pandas as pd import numpy as np +import polars as pl from everviz.pages.summary_values import page_layout, _summary_values from everviz.plugins.summary_plot.util import calculate_statistics @@ -33,7 +34,7 @@ def test_empty_summary_values(mocker): """Test for the case of missing summary values.""" mock_api = mocker.Mock() mock_api.output_folder = "dummy" - mock_api.summary_values.return_value = pd.DataFrame() + mock_api.summary_values.return_value = pl.DataFrame() layout = page_layout(mock_api) assert not layout