diff --git a/everviz/pages/deltaplot.py b/everviz/pages/deltaplot.py index 83d3615..f8cf20d 100644 --- a/everviz/pages/deltaplot.py +++ b/everviz/pages/deltaplot.py @@ -22,7 +22,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 c01469d..f68b3c2 100644 --- a/everviz/pages/summary_values.py +++ b/everviz/pages/summary_values.py @@ -25,7 +25,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 8690a33..0a21cc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,8 @@ test = [ "dash[testing]", "pillow", "pytest-mock", - "sphinx" + "sphinx", + "polars" ] style = [ "pre-commit", 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 2a74161..b97afa3 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.pages.deltaplot import _get_summary_delta_values from everviz.plugins.delta_plot.delta_plot import DeltaPlot @@ -23,7 +23,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", @@ -60,7 +60,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 868ffb4..bc3fb5b 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, _get_summary_delta_values, @@ -59,7 +59,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) @@ -77,7 +77,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")) @@ -96,7 +96,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 b016082..0c2ecb6 100644 --- a/tests/unit/test_summary_plot.py +++ b/tests/unit/test_summary_plot.py @@ -2,6 +2,7 @@ import numpy as np import pandas as pd +import polars as pl from everviz.pages.summary_values import _summary_values, page_layout from everviz.plugins.summary_plot.util import calculate_statistics @@ -32,7 +33,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