我正在做一个材料科学的机器学习项目,这段代码要求我选择要上传的文件,但是当我为文件命名时,它会出现一条错误消息。代码的开头(和相关位)包括在下面:
import xlrd
import re
import numpy
from sklearn import svm
from sklearn import preprocessing
from sklearn import tree
from sklearn.ensemble import RandomForestClassifier
import random
import os
from xlutils.copy import copy
import xlsxwriter
import graphviz
def main():
pastExperiments = StoredData()
response = input('Do you wish to use continuous representation of discreet data if available data? y or n\t')
if response == 'y':
pastExperiments.useContinuousRepresentation = True
else:
pastExperiments.useContinuousRepresentation = False
response = input('Do you want to choose import data? y or n\t')
if response == 'y':
while response == 'y':
nameOfFile = input('What is the name of the file you wish to import.\t')
pastExperiments.importFile('./Input/' + nameOfFile)
response = input('Do you wish to import additional data? y or n\t')
#At this point all training data should have been imported.
else:
folder = os.fsencode('Input')
for inputFile in os.listdir(folder):
fileName = os.fsdecode(inputFile)
if fileName.endswith(".xlsx"):
pastExperiments.importFile('./Input/' + fileName)
else:
continue
这是我收到的错误消息:
FileNotFoundError: [Errno 2] No such file or directory: './Input/Sample_info_.xlsx'
谢谢!