Skip to content
Advertisement

Getting value error for INT when posting DataFrame values to psycopg2

I’m trying to insert a data to postgresql from a dataframe like this

But getting this error code

My sql table was created like this

Advertisement

Answer

The error says what’s the problem – the program expects integer and you pass list of integers there.

It’s because execute is used to insert single row and as second parameter you should have single tuple of lenght 5. If you want to insert many parameters, use executemany and pass list of tuples

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement