[Python] How can I fix "Error tokenizing data" on pandas csv reader?

Discussão em 'Python' iniciado por Stack, Setembro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to read a csv file with pandas.

    This file actually has only one row but it causes an error whenever I try to read it.

    Something wrong seems happening in line 8 but I could hardly find the 8th line since there's clearly only one row on it.

    I do like:

    with codecs.open("path_to_file", "rU", "Shift-JIS", "ignore") as file:

    df = pd.read_csv(file, header=None, sep="\t")
    df


    Then I get:

    ParserError: Error tokenizing data. C error: Expected 1 fields in line 8, saw 3

    I don't get what's really going on, so any of your advice will be appreciated.

    Continue reading...

Compartilhe esta Página