As a data scientist you may probably use Pandas a lot to play with your data.
While it’s quite easy to read data from PostgreSQL combined with Psycopg2:
but writing the data back to PostgreSQL we need to create some adapters. As the Pandas API doc(scroll down to bottom) shows, you may do:
Notice we adapt the base type as Pandas internal storing of float/int may be a little different from what you see in ‘dtype’