I trying to run SQL query on a Pandas dataframe using pandasql.
import pandas as pd
import pandasql.sqldf as exec_sql
df = pd.DataFrame({'a': [1, 2, 3], 'b':[7, 8, 9]})
exec_sql("select top(3) * from df")
I'm having this error, that I could not find the reason.
error message:
PandaSQLException: (sqlite3.OperationalError) near "from": syntax error
[SQL: select top(3) * from df]
(Background on this error at: http://sqlalche.me/e/e3q8)
I try to read carefully the background of the error, from the error's message here but I could not found the cause. Maybe anyone might help to give me a track, please.
df.head(3)