Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何从随附的SemEval 2017文本文件中读取列数据_Python 3.x - Fatal编程技术网

Python 3.x 如何从随附的SemEval 2017文本文件中读取列数据

Python 3.x 如何从随附的SemEval 2017文本文件中读取列数据,python-3.x,Python 3.x,我想从数据文件中读取标签列和文本列。前面我使用pandas来读取列数据。但是,SemEval2017文件的格式不允许我按列读取数据。如何从文件中分离标签和文本。之前,我使用以下代码从文件中读取“tweets”列 df = pd.read_csv('c:/STS-Gold1.csv', sep=';') for i,ir in df.iterrows(): txt = preprocess_text(str(ir['tweet'])) myData.append(txt) 已附加

我想从数据文件中读取标签列和文本列。前面我使用pandas来读取列数据。但是,SemEval2017文件的格式不允许我按列读取数据。如何从文件中分离标签和文本。之前,我使用以下代码从文件中读取“tweets”列

df = pd.read_csv('c:/STS-Gold1.csv', sep=';')
for i,ir in df.iterrows():
    txt = preprocess_text(str(ir['tweet']))
    myData.append(txt)
已附加文本文件中的快照。。我试图将文件保存为.csv格式,但没有用

文件中的几个示例如下:

620013074272137216  positive    Call for reservations for lunch or dinner tomorrow (yep Sunday!). Happy to accommodate guests in town for the MISS USA Pageant 346-5100 
620015047889154048  neutral "Miss Universe Org prez tells me #Trump won't attend Sunday's Miss USA event He's missed some in the past, but he said recently he'd be here"   
620015649151021056  neutral Trump said June 30th that he'd be at Miss USA pageant in Baton Rouge. Organizers say he's not coming. No word yet from his camp on his plans    
620017122081685504  neutral Haven't read To Kill a Mockingbird in years. That may be a good thing for when I read Go Set a Watchman. Might make it less heartbreaking.  

你能不能把你的数据记录下来,让你的例子重现,这将有助于大家理解,也许你会得到更好的帮助我编辑了我的问题。