Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.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中使用熊猫读取带文本的制表符分隔文件_Python_Python 3.x_Pandas - Fatal编程技术网

在python中使用熊猫读取带文本的制表符分隔文件

在python中使用熊猫读取带文本的制表符分隔文件,python,python-3.x,pandas,Python,Python 3.x,Pandas,我有一个包含大量文本数据的txt文件,sep=”“不起作用,因为第二列都是字符串 数据结构: sentence_index sentence 1 The Rock is destined to be the 21st Century 's new `` Conan '' and that he 's going to make a splash even greater than Arnold Schwarzenegger , Jean-Claud Van Damme or Steven

我有一个包含大量文本数据的txt文件,
sep=”“
不起作用,因为第二列都是字符串

数据结构:

sentence_index  sentence
1   The Rock is destined to be the 21st Century 's new `` Conan '' and that he 's going to make a splash even greater than Arnold Schwarzenegger , Jean-Claud Van Damme or Steven Segal .
2   The gorgeously elaborate continuation of `` The Lord of the Rings '' trilogy is so huge that a column of words can not adequately describe co-writer\/director Peter Jackson 's expanded vision of J.R.R. Tolkien 's Middle-earth .
3   Effective but too-tepid biopic
我使用的代码是:

sentences = pd.read_csv("filename.txt", sep=" ",error_bad_lines=False)

你能分享一个数据的例子吗?请对所有与python相关的问题始终使用generic[python]标记。不管怎样,什么不起作用?“第二列都是字符串”是什么意思?您说分隔符是一个制表符,但您传递的是一个空格作为分隔符…您想要的
sep
\t