I'm trying to read data from sqlite3 database into a Dataframe. The problem is, that my numbers in the DB look like following 21.639929701230166. And if I print my df the number gets rounded to 21.639930. But I need the exact number for my PCA.
db_conn = sqlite3.connect(DATABASE_FILE)
sql_query = pd.read_sql_query('''SELECT AvgRT FROM sensordata''', db_conn)
df = pd.DataFrame(sql_query)
I saw that there is float_precision for csv. https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
Is there anything for SQL?
I already tried to cast it (like seen here: https://stackoverflow.com/a/70603287:
sql_query = pd.read_sql_query('''SELECT cast(AvgRT as decimal(25,25)) as AvgRT FROM sensordata''', db_conn)
but this results in the same number 21.639930 as before.
pd.options.display.precision = 0