Ever wish you could query pandas DataFrames with SQL like this?
df = pd.DataFrame(...)
sqldf.query_df(df, """
SELECT *, sum(b)
WHERE a > 5
GROUP BY b
""")
Well now you can with sqldf!
SELECT
WHERE
=
,!=
,>
,>=
,<
,<=
,IN
,NOT IN
SELECT ... AS
FROM
GROUP BY
JOIN
WHERE ... LIKE
ORDER BY
A PEG grammar is defined in sqldf/sql.gram
that is passed through pegen to generate the parser in sqldf/parser.py
that parses the SQL and generates objects (currently dictionaries). The generated objects are then processed to build up the relevant pandas calls to return the processed DataFrame.