pandas
Posts tagged "pandas"
2 posts
How to Safely Upsert DataFrames into Postgres
I share a Python script that safely upserts Pandas DataFrames into a Postgres database using psycopg2, highlighting the importance of handling potential SQL injection risks. I explain the process of constructing SQL statements to manage inserts and updates based on specified constraints, while utilizing the `execute_batch` function for efficient batch processing.
How to reduce the memory used by Pandas DataFrames
A script illustrating how the memory usage of a pandas DataFrame can be reduced through altering data types.