我试着做以下手术:
import pymsql
import pandas as pd
df:
id height_code name ...
1 34 123123 Jesus
2 84 3421 Heaps
3 23 45243 Ornitorrincus
...
connection=pymysql.connect(host=xxx,user=xxxx,password=xxxx,db=xxxx)
for i in df.index:
df2=pd.read_sql("select business_id,name,color from table123 where business_id=%s;",connection) % df['id'][i]
这里的想法是只使用business_id = df['id'][i]
中的行访问一个巨大的sql和filter table123
但是,我得到了以下错误:
^{pr2}$所以,显然我在pymsql中的%s
synthax有问题。试着看一下他们的手册,但没有找到一个很好的解释。在
有人能帮忙吗?在
你有:
必须是:
^{pr2}$相关问题 更多 >
编程相关推荐