https://github.com/steviecurran/sql2pandas
Translate SQL queries into pandas operations for fast exploratory analysis and data transformation in Python
https://github.com/steviecurran/sql2pandas
database pandas python query sql
Last synced: 2 months ago
JSON representation
Translate SQL queries into pandas operations for fast exploratory analysis and data transformation in Python
- Host: GitHub
- URL: https://github.com/steviecurran/sql2pandas
- Owner: steviecurran
- Created: 2025-02-12T06:19:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-23T19:11:03.000Z (3 months ago)
- Last Synced: 2026-03-24T17:23:18.878Z (3 months ago)
- Topics: database, pandas, python, query, sql
- Language: Jupyter Notebook
- Homepage:
- Size: 346 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## SQL2pandas ##
Translate SQL queries into equivalent pandas operations.
**Motivation**
Many analysts are fluent in SQL but need to transition to Python data workflows.
**Example**
SQL:
SELECT country, AVG(revenue)
FROM sales
GROUP BY country;
Equivalent pandas:
df.groupby("country")["revenue"].mean()
**Features**
- SQL SELECT / WHERE / GROUP BY equivalents
- Translation helper functions
- Examples for analysts moving to pandas

I suggest you download the Jupyter notebook and run it locally to get the full functionality (e.g. the table of contents) and let me know if there's anything you want added.
See https://github.com/steviecurran/sql2csv to convert .sql to .csv, via the C shell