错误:
PandaSQLException: (sqlite3.OperationalError) no such table: aadhaar_data [SQL: 'select registrar,enrolment_agency from aadhaar_data limit 50;'] (此错误的背景:http ://sqlalche.me/e/e3q8 )
我的代码:
import pandas as pd
import pandasql as ps
#how to use sql commands
df=pd.read_csv("C:\\Users\\lenovo\\.spyder-py3\\Aadhaar_data.csv")
#we rename the columns
# by replacing spaces with underscores and setting all characters to
lowercase, so the
# column names more closely resemble columns names one might find in a table
df.rename(columns = lambda x: x.replace(' ', '_').lower(), inplace=True)
print(df)
q="""SELECT registrar,enrolment_agency FROM Aadhaar_data lIMIT 50;"""
#p="""SELECT * from aadhar_data;"""\
aadhaar_solution = ps.sqldf(q.lower(), locals())
print(aadhaar_solution)
aadhaar_solution=ps.execute_sql(q)`