Member-only story

Pandas merge() and read_sql() — joining DataFrames.

Josh Otwell
2 min readAug 28, 2019

--

I have written several articles recently, about pandas and PostgreSQL database interaction — specifically in loading CSV data. In this post, I’ll cover what I have recently learned using pandas merge() and read_sql_query(), retrieving query results using ‘s and similar queries.

Photo by pine watt on Unsplash

OS, Database, and software used:

  • Xubuntu Linux 18.04.2 LTS (Bionic Beaver)
  • PostgreSQL 11.4
  • Python 3.7.4
  • pandas-0.25.0

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

Feel free to visit these similar posts about pandas and SQL…

For starters, I import pandas, SQLAlchemy, and create a connection to the PostgreSQL database:

>>> import pandas as pd
>>> import sqlalchemy
>>> from sqlalchemy import create_engine
>>>…

--

--

Josh Otwell
Josh Otwell

Written by Josh Otwell

SQL/PHP | Photography | Technical Consultant. Sign-up for my free developer newsletter, OpenLampTech, here: openlamptech.substack.com

No responses yet