How do I keep the word iris-setosa as text in python: df=pd.read_sql('SELECT class = 'iris-setosa' FROM tbl_iris',cnxn)

Asked

Viewed 18 times

-1

Olha o conexão já foi feita com sucesso no SQL Sever, já testei comandos como: df=pd.read_sql('SELECT class FROM tbl_iris',cnxn) ou até mesmo df = pd.read_sql('SELECT sepal_width,petal_length,petal_width,class FROM tbl_iris WHERE sepal_width > 2.5',cnxn) e funcionam normalmente. the problem is ' ' syntax to reference the word iris-setosa. PS: the problem is the quotation marks could be any other word in place of iris-setosa, in this case any word that is inside the class column

1 answer

0

See if this solves:

df=pd.read_sql("SELECT class = 'iris-setosa' FROM tbl_iris",cnxn)

Notice that I put double quotes externally.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.