Skip to main content

No project description provided

Project description

Pandas Sqlite3

This project is to simplify the joining of pandas dataframes using Sqlite3. In the world of data science there are often two camps 1)Pandas and 2)SQL. We want to bring these worlds together by making it easier for those more familiar with SQL to manipulate Pandas dataframes within python. With Pandas Sqlite3 one can simply pass a list of Pandas dataframes, their names, and a Sqlite3 statement to be executed. Enjoy :)

Authors

Installation

Install my-project with pip

 pip install pandas_sqlite3

Example Use

import pandas as pd
from pandas_sqlite3.pandas_query import pandas_query

# create dataframes
sample_df = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')

long_petal_df = sample_df.loc[sample_df['petal_length'] > 5].copy()

# write sql query
sql_query = """
                SELECT 
                        S.*
                FROM sample_df s
                JOIN long_petal_df USING ('sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species')
            """

# pass dataframes, their names, and SQL query to pandas_query function
final_df = pandas_query(dfs=[sample_df, long_petal_df], df_names=['sample_df', 'long_petal_df'], sql=sql_query)

Contributing

Contributions are always welcome!

License

MIT

Acknowledgements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas_sqlite3-0.1.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

pandas_sqlite3-0.1.0-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page