Sono nuovo di Python e Panda. Sto cercando di ottenere un file tsv
caricato in un panda DataFrame
.Come caricare un file tsv in un DataFrame di Pandas?
Questo è quello che sto cercando e l'errore che sto ricevendo:
>>> 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!
Per chi arriva a questa risposta nel 2017+, usa 'read_csv ('path_to_file', sep = '\ t')'. Vedere [questa risposta sotto] (https://stackoverflow.com/a/34548894/3707607) –