AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'
AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'
我正在尝试加载文件 titanic,但遇到以下问题。我的代码是:
from sklearn import datasets
titanic = datasets.load_titanic()
我得到以下信息:
AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'
虽然我可以加载另一个文件。谁能帮忙?
According to the documentation,当前稳定版(scikit-learn v0.19.1
)没有玩具数据集load_titanic()
- 您使用的是哪个版本?您通过 sklearn.__version__
.
获取版本
文档中提供了以下玩具数据集:
load_boston()
load_iris()
load_diabetes(
load_digits()
load_linnerud()
load_wine()
load_breast_cancer()
也许您的教程已经过时了?
sklearn v0.20.2 也没有 load_titanic
。您可以轻松使用:
import seaborn as sns
titanic=sns.load_dataset('titanic')
但请注意,这只是数据的一个子集。泰坦尼克号的乘客总数为2223人(或2224人),幸存者人数为706人。请看Wikipedia。
我正在尝试加载文件 titanic,但遇到以下问题。我的代码是:
from sklearn import datasets
titanic = datasets.load_titanic()
我得到以下信息:
AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'
虽然我可以加载另一个文件。谁能帮忙?
According to the documentation,当前稳定版(scikit-learn v0.19.1
)没有玩具数据集load_titanic()
- 您使用的是哪个版本?您通过 sklearn.__version__
.
文档中提供了以下玩具数据集:
load_boston()
load_iris()
load_diabetes(
load_digits()
load_linnerud()
load_wine()
load_breast_cancer()
也许您的教程已经过时了?
sklearn v0.20.2 也没有 load_titanic
。您可以轻松使用:
import seaborn as sns
titanic=sns.load_dataset('titanic')
但请注意,这只是数据的一个子集。泰坦尼克号的乘客总数为2223人(或2224人),幸存者人数为706人。请看Wikipedia。