有人可以告诉我这个Python代码中是否存在SQL语句问题或任何其他问题?我无法让脚本运行。
import pandas
import pandasql
def avg_weekend_temperature(filename):
weather_data =
pandas.read_csv('c:/python27/data/weather_underground.csv')
q = 'SELECT AVG(meantempi) FROM weather_data WHERE
DATENAME(weekday,date)=Saturday OR
DATENAME(weekday,date)=Sunday';
mean_weekend_temp = pandasql.sqldf(q.lower(), locals())
print mean_weekend_temp
return mean_weekend_temp
avg_weekend_temperature('c:/python27/data/weather_underground.csv')