[Python] Querying using psycopg2 rounds values down [closed]

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am running a SQL query in python, but the return values are rounding my values. I have one datapoint where I know the value in the database is 0.00000000283, but it's rounding down to 0. I know the value is "basically 0" but is there any way to stop python from rounding down to maintain the integrity of my data?

    Here's my code:

    import pandas as pd
    import psycopg2
    database=psycopg2.connect(host={},user={},port={})
    df=pd.read_sql("SELECT * FROM {}",database)


    I get the same roundoff when working with database.cursor() so I know it's not pandas. Any help would be appreciated.

    Continue reading...

Compartilhe esta Página