Python 3.x 无法使用numpy loadtxt加载csv文件
我无法使用numpy loadtxt函数加载csv文件。文件格式一定有问题或其他问题。我正在使用macbook上的anocanda笔记本电脑Python 3.x 无法使用numpy loadtxt加载csv文件,python-3.x,numpy,Python 3.x,Numpy,我无法使用numpy loadtxt函数加载csv文件。文件格式一定有问题或其他问题。我正在使用macbook上的anocanda笔记本电脑 OSError: Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv not found. np.loadtxt("Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv") 我尝试了在stackflow上找到的解决方案,包括:
OSError: Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv not found.
np.loadtxt("Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv")
我尝试了在stackflow上找到的解决方案,包括:
f = open(u"Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv")
f = open("Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv")
上述操作不起作用-没有此类文件或目录错误大多数情况下是由于某些未转义的许可证,请尝试使用原始字符串:
r"Macintosh HD\\Users\\binhao\\Downloads\\Iris_data.csv"
“文件格式一定有问题”不,错误是告诉您该路径上没有文件。格式化错误不会导致这种情况。我很确定这是正确的路径。我仔细检查过了。