【发布时间】:2015-02-16 08:00:42
【问题描述】:
我有一个 csv 文件,我通过 pandas 读取它。然后我试图对该文件调用 mysql 查询,这引发了错误。
import pandas
import pandasql
fl=pandas.read_csv('file.csv')
文件的列是
fl.columns
Index([ u'time', u'contact', u'address'], dtype='object')
查询是
q=u"""
SELECT contact FROM fl LIMIT 50
"""
我的运行方式
fl_solution=pandasql.sqldf(q,locals())
我得到的错误是:-
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
【问题讨论】: