Skip to content

Commit 6a5b357

Browse files
committed
load boston dataset from examples instead of sklearn.
1 parent fa0df21 commit 6a5b357

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/conftest.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,14 @@ def airline_dataset():
471471
@pytest.fixture
472472
def boston_dataset():
473473
"""Regression dataset."""
474-
pytest.importorskip('sklearn')
475474
pd = pytest.importorskip('pandas')
476-
from sklearn import datasets
477475

478-
raw = datasets.load_boston()
479-
df = pd.DataFrame(raw.data, columns=raw.feature_names)
480-
df['Price'] = raw.target
476+
df = pd.read_csv('examples/data/boston_house_prices.csv')
477+
478+
# Uppercase column names to match names used by scikit-learn (dataset was originally loaded through
479+
# sklearn before it was removed in v1.2).
480+
df.columns = [c.upper() for c in df.columns]
481+
df = df.rename(columns={"MEDV": "Price"})
481482
return df
482483

483484

0 commit comments

Comments
 (0)