python - Confusing read_table error in pandas -


i trying read seeds dataset using pandas. when loading file using:

df = pd.read_table("seeds_dataset.txt", header=none)  

i get:

cparsererror: error tokenizing data. c error: expected 8 fields in line 8, saw 10 

now, loading file excel, needed specify tab , space delimiters @ same time, correctly read file @ line 8, can't done pandas (as far know). sublime text reads file accurately directly.

i don't want skip bad lines error_bad_lines there nothing wrong them. used lineterminator no success.

try option "delim_whitespace".

df = pd.read_table("seeds_dataset.txt", header=none, delim_whitespace = true)  

edit: more detailed explanation:

the method signature read_table here. has sorts of options, 1 of sep. defines delimiter between fields, , default '\t' (tab). 1 solution change sep argument. python implementation of pandas parser lets use regex delimiters, sep = "\\s+" delimit on amount of whitespace. however, c parser (which looks you're using error message) doesn't let use regex. have delim_whitespace option, though, fit needs exactly!


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -