[Python] What to do when the pandas error position overflows?

Discussão em 'Python' iniciado por Stack, Agosto 21, 2025.

  1. Stack

    Stack Membro Participativo

    So, I'm experimenting with pandas with the IMDB files, especially title.basic.tsv. When trying to parse the runtimeMinutes column to "Int64", I get an error

    ValueError: Unable to parse string "Reality-TV" at position 47993


    However, neither line 47994, nor the directly surrounding lines, contain the string Reality-TV. So I started deleting entries from the beginning of the data file, and indeed, the reported position got down. Just until I deleted exactly 47994 entries, at which point the error became

    ValueError: Unable to parse string "Reality-TV" at position 65535


    This raised my suspicion that the position variable is a uint16 which overflows? Is there a way to deal with this kind of problem, and get the correct line which is making trouble?


    Here is the command I used:

    titles = pd.read_csv("title.basics.tsv",
    sep="\t",
    dtype={
    "runtimeMinutes": "Int64",
    },
    na_values={
    "runtimeMinutes": ["\\N"],
    })

    Continue reading...

Compartilhe esta Página