我是python和pandas的新手。我正在尝试将tsv
文件加载到熊猫中DataFrame
。
这是我正在尝试的错误:
>>> df1 = DataFrame(csv.reader(open('c:/~/trainSetRel3.txt'), delimiter='\t'))
Traceback (most recent call last):
File "<pyshell#28>", line 1, in <module>
df1 = DataFrame(csv.reader(open('c:/~/trainSetRel3.txt'), delimiter='\t'))
File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 318, in __init__
raise PandasError('DataFrame constructor not properly called!')
PandasError: DataFrame constructor not properly called!
感谢@TedPetrou
—
Salomon Kabongo
read_csv('path_to_file', sep='\t')
。请在下方