sklearn.datasets.load_boston

sklearn.datasets.load_boston(*, return_X_y=False)[source]

Load and return the boston house-prices dataset (regression).

Samples total

506

Dimensionality

13

Features

real, positive

Targets

real 5. - 50.

Read more in the User Guide.

Parameters
return_X_ybool, default=False

If True, returns (data, target) instead of a Bunch object. See below for more information about the data and target object.

New in version 0.18.

Returns
dataBunch

Dictionary-like object, with the following attributes.

datandarray of shape (506, 13)

The data matrix.

targetndarray of shape (506, )

The regression target.

filenamestr

The physical location of boston csv dataset.

New in version 0.20.

DESCRstr

The full description of the dataset.

feature_namesndarray

The names of features

(data, target)tuple if return_X_y is True

New in version 0.18.

Notes

Changed in version 0.20: Fixed a wrong data point at [445, 0].

Examples

>>> from sklearn.datasets import load_boston
>>> X, y = load_boston(return_X_y=True)
>>> print(X.shape)
(506, 13)