8000 use _convert_container in test · patrickkwang/scikit-learn@8534099 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8534099

Browse files
committed
use _convert_container in test
1 parent 4c06adf commit 8534099

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

sklearn/inspection/_plot/tests/test_boundary_decision_display.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from sklearn.preprocessing import scale
1818
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
1919
from sklearn.utils._testing import (
20+
_convert_container,
2021
assert_allclose,
2122
assert_array_equal,
2223
)
@@ -468,17 +469,18 @@ def test_string_target(pyplot):
468469
)
469470

470471

471-
@pytest.mark.parametrize("df_module_name", ["pandas", "polars"])
472-
def test_dataframe_support(pyplot, df_module_name):
472+
@pytest.mark.parametrize("constructor_name", ["pandas", "polars"])
473+
def test_dataframe_support(pyplot, constructor_name):
473474
"""Check that passing a dataframe at fit and to the Display does not
474475
raise warnings.
475476
476477
Non-regression test for:
477478
* https://github.com/scikit-learn/scikit-learn/issues/23311
478479
* https://github.com/scikit-learn/scikit-learn/issues/28717
479480
"""
480-
df_module = pytest.importorskip(df_module_name)
481-
df = df_module.DataFrame({"col_x": X[:, 0], "col_y": X[:, 1]})
481+
df = _convert_container(
482+
X, constructor_name=constructor_name, columns_name=["col_x", "col_y"]
483+
)
482484
estimator = LogisticRegression().fit(df, y)
483485

484486
with warnings.catch_warnings():

sklearn/utils/_set_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def register(self, adapter):
198198

199199

200200
def _get_adapter_from_container(container):
201-
"""Get the adapter that nows how to handle such container.
201+
"""Get the adapter that knows how to handle such container.
202202
203203
See :class:`sklearn.utils._set_output.ContainerAdapterProtocol` for more
204204
details.

0 commit comments

Comments
 (0)
0