An open API service indexing awesome lists of open source software.

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

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

![](https://raw.githubusercontent.com/steviecurran/SQL2pandas/refs/heads/main/Jupyter_example.png)

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