找不到OSError tsv

问题描述 投票:0回答:2

我正在接受这个错误: OSError:\ C:\ Users \ u165127 \ Desktop \ Restaurant_Reviews.tsv未找到。

我感到很困惑!

#import the libraries
import numpy as np
import pandas as pd
#import the dataset
import scipy as sp
data = sp.genfromtxt(r'\C:\Users\u165127\Desktop\Restaurant_Reviews.tsv',delimiter='\t',encoding='utf-8')
python-3.x sentiment-analysis
2个回答
0
投票

这意味着r'\C:\Users\u165127\Desktop\Restaurant_Reviews.tsv'给出的文件位置不存在。

你可以试试:'C:\Users\u165127\Desktop\Restaurant_Reviews.tsv'

或者如果脚本从C:\Users\u165127\Desktop运行,只需尝试"./Restaurant_Reviews.tsv"


0
投票
def load_csv(Restaurant_Reviews):
    file = open(Restaurant_Review, 'r')
    text = file.read()
    file.close()
    return text

This is running but I do not understand the difference

© www.soinside.com 2019 - 2024. All rights reserved.