[Python] Pandas - decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] during...

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am running an extraction of a table in Python using Pandas. I am getting this error:


    decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
    ​

    The code:

    dataframes[table] = pd.read_sql(f'SELECT * FROM {schema_origem}.{table}', oracle_engine)


    Probably is an error in some column, how do I resolve this?

    I've already tried with coerce_float=False:

    dataframes[table] = pd.read_sql(f'SELECT * FROM {schema_origem}.{table}', oracle_engine, coerce_float=False)


    Or astype(str):

    dataframes[table] = pd.read_sql(f'SELECT * FROM {schema_origem}.{table}', oracle_engine, coerce_float=False).astype(str)

    Continue reading...

Compartilhe esta Página