Я пишу запрос SQL в питона панд:SQL запросов в панд питона
import pandas as pd
from pandas import DataFrame, read_csv
import numpy as np
from pandasql import sqldf
pysqldf=lambda q:sqldf(q,globals())
rolup = pysqldf(u"select MasterUserId,DeviceUsed,hcluster, count(MasterUserId) as Tot_Rec, sum(Visits),sum(PV),sum(TimeSpent) from clstrd_data group by MasterUserId,DeviceUsed,hcluster;")
Ошибка:
sqlite3.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.
Как переключиться на строки Unicode? Я использую python2.7.
новый код: import pandas as pd from pandas import DataFrame, read_csv импортировать numpy как np из pandasql import sqldf pysqldf = lambda q: sqldf (q, globals()) rolup = pysqldf (u "select MasterUserId, DeviceUsed, hcluster, count (MasterUserId) как Tot_Rec, sum (Visits), sum (PV), sum (TimeSpent) из группы clstrd_data с помощью MasterUserId, DeviceUsed, hcluster; ") –