python-3.xpython-3.6attributeerrorsklearn-pandas

AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'


I am trying to load the file titanic and I face the following problem. My code is:

from sklearn import datasets
titanic = datasets.load_titanic()

I get the following:

AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'

While I can load another file. Can anyone help?


Solution

  • According to the documentation, there is no toy dataset load_titanic() for the current stable version (scikit-learn v0.19.1) - which version are you using? You get the version via sklearn.__version__.

    From the docs, there are the following toy datasets available:

    load_boston()
    load_iris()
    load_diabetes(
    load_digits()
    load_linnerud()
    load_wine()
    load_breast_cancer()
    

    Maybe your tutorial is outdated?