I'm wondering if we could save some overhead by loading from the database directly into a dataframe. As the number of rows grows, loading all records from the database is going to fail.
https://hackersandslackers.com/connecting-pandas-to-a-sql-database-with-sqlalchemy/