diff --git a/sklearn/datasets/_twenty_newsgroups.py b/sklearn/datasets/_twenty_newsgroups.py index 7fe17cbcb0a7a..24046367c69c6 100644 --- a/sklearn/datasets/_twenty_newsgroups.py +++ b/sklearn/datasets/_twenty_newsgroups.py @@ -479,7 +479,7 @@ def fetch_20newsgroups_vectorized( vectorizer = CountVectorizer(dtype=np.int16) X_train = vectorizer.fit_transform(data_train.data).tocsr() X_test = vectorizer.transform(data_test.data).tocsr() - feature_names = vectorizer.get_feature_names() + feature_names = vectorizer.get_feature_names_out() joblib.dump((X_train, X_test, feature_names), target_file, compress=9) diff --git a/sklearn/utils/tests/test_validation.py b/sklearn/utils/tests/test_validation.py index 2cbbaac35a31b..167118fb4ff8f 100644 --- a/sklearn/utils/tests/test_validation.py +++ b/sklearn/utils/tests/test_validation.py @@ -1414,8 +1414,8 @@ def test_check_pandas_sparse_invalid(ntype1, ntype2): pd = pytest.importorskip("pandas", minversion="0.25.0") df = pd.DataFrame( { - "col1": pd.arrays.SparseArray([0, 1, 0], dtype=ntype1), - "col2": pd.arrays.SparseArray([1, 0, 1], dtype=ntype2), + "col1": pd.arrays.SparseArray([0, 1, 0], dtype=ntype1, fill_value=0), + "col2": pd.arrays.SparseArray([1, 0, 1], dtype=ntype2, fill_value=0), } ) @@ -1456,8 +1456,8 @@ def test_check_pandas_sparse_valid(ntype1, ntype2, expected_subtype): pd = pytest.importorskip("pandas", minversion="0.25.0") df = pd.DataFrame( { - "col1": pd.arrays.SparseArray([0, 1, 0], dtype=ntype1), - "col2": pd.arrays.SparseArray([1, 0, 1], dtype=ntype2), + "col1": pd.arrays.SparseArray([0, 1, 0], dtype=ntype1, fill_value=0), + "col2": pd.arrays.SparseArray([1, 0, 1], dtype=ntype2, fill_value=0), } ) arr = check_array(df, accept_sparse=["csr", "csc"])