Pandasql: sqldf 执行错误
Pandasql: sqldf executing error
我想使用 pandasql 执行 sql-查询 "SELECT 1"。但是出现错误:
Traceback (most recent call last):
File "C:\Users\AdminVAIO\Documents\Visual Studio
2013\Projects\crm\crm\crm.py", line 47, in <module>
print(ps.sqldf(s, locals()))
File "C:\Python34\lib\site-packages\pandasql\sqldf.py", line 155, in
sqldf
return PandaSQL(db_uri)(query, env)
File "C:\Python34\lib\site-packages\pandasql\sqldf.py", line 61, in
__call__
result = read_sql(query, conn)
File "C:\Python34\lib\site-packages\pandas\io\sql.py", line 421, in read_sql
coerce_float=coerce_float, parse_dates=parse_dates)
File "C:\Python34\lib\site-packages\pandas\io\sql.py", line 1046, in read_sql
cursor = self.execute(*args)
File "C:\Python34\lib\site-packages\pandas\io\sql.py", line 1025, in execute
cur = self.con.cursor()
AttributeError: 'Connection' object has no attribute 'cursor'
Press any key to continue . . .
这里是代码(Python 3.4,pandasql 0.7.1,pandas 0.14.1):
import pandas as pd
import pandasql as ps
s = """
SELECT 1
"""
print(ps.sqldf(s, locals()))
请帮帮我!
现在,它起作用了!
我刚刚安装了 pandas 0.17.0 而不是 0.14.1
这对我有用:
pip install -U pandasql
我想使用 pandasql 执行 sql-查询 "SELECT 1"。但是出现错误:
Traceback (most recent call last):
File "C:\Users\AdminVAIO\Documents\Visual Studio
2013\Projects\crm\crm\crm.py", line 47, in <module>
print(ps.sqldf(s, locals()))
File "C:\Python34\lib\site-packages\pandasql\sqldf.py", line 155, in
sqldf
return PandaSQL(db_uri)(query, env)
File "C:\Python34\lib\site-packages\pandasql\sqldf.py", line 61, in
__call__
result = read_sql(query, conn)
File "C:\Python34\lib\site-packages\pandas\io\sql.py", line 421, in read_sql
coerce_float=coerce_float, parse_dates=parse_dates)
File "C:\Python34\lib\site-packages\pandas\io\sql.py", line 1046, in read_sql
cursor = self.execute(*args)
File "C:\Python34\lib\site-packages\pandas\io\sql.py", line 1025, in execute
cur = self.con.cursor()
AttributeError: 'Connection' object has no attribute 'cursor'
Press any key to continue . . .
这里是代码(Python 3.4,pandasql 0.7.1,pandas 0.14.1):
import pandas as pd
import pandasql as ps
s = """
SELECT 1
"""
print(ps.sqldf(s, locals()))
请帮帮我!
现在,它起作用了!
我刚刚安装了 pandas 0.17.0 而不是 0.14.1
这对我有用:
pip install -U pandasql