0

Код

import pandas
from sklearn import tree
table = pandas.read_csv('weather.csv')
X = table.loc[:, ['humidity', 'pressure']]
y = table['label']
classifier = tree.DecisionTreeClassifier(max_depth=2)
classifier.fit(X, y)
prediction = classifier.predict([[80, 1009]])
print(prediction)

Ошибка

NameError: name 'table' is not defined
FileNotFoundError: File b'weather.csv' does not exist
NameError: name 'table' is not defined
NotFittedError: This DecisionTreeClassifier instance is not fitted yet. Call 'fit' with appropriate arguments before using this method.
2
  • 1
    А где ваш файл weather.scv находится?
    – Tivyram
    23 мар 2018 в 7:31
  • Укажите полный путь к файлу 23 мар 2018 в 7:42

1 ответ 1

0

Ошибка возникает потому, что файл 'weather.csv' не найден. Убедитесь, что имя файла написано правильно, и что он находится в той же папке, что и программа.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.