I'm reading a sql table full of stock prices with pandas, but I am having the problem that the prices are object type when using them on my python code. In my sql table i have some #N/A values that I cannot get rid of (I don't want to).
I know that it would be possible to give the prices the float type on my code, but I would like them to be floats when I import them from the sql server.
I tried changing the "," separator and keeping it but i don't get results.
Thanks for your attention
import pandas as pd
import sqlite3
conn = sqlite3.connect('C:\\Users\\Desktop\\db.sqlite3')
df = pd.read_sql("SELECT replace(IndexLevel, ',', '.') AS prices, PriceDate FROM IndexLevel",
conn, parse_dates="PriceDate")
coerce_floatargument solve the problem?