Pandas: Write DataFrame to table with to_sql
You can write DataFrames to a database table via a sqlalchemy
connection as follows:
from sqlalchemy import create_engine
engine = create_engine('postgresql://scott:tiger@localhost:5432/database')
df.to_sql('table_name', engine)
Via Stack Overflow.
Leave a comment