[Python] How to solve can't adapt type 'Series' in psycopg2

Discussão em 'Python' iniciado por Stack, Janeiro 29, 2025.

  1. Stack

    Stack Membro Participativo

    I want to insert a record with psycopg2. The code is simple:

    import psycopg2
    query = """
    INSERT INTO xxx (lon,lat)
    VALUES(%s,%s)"""
    cursor.execute(query, (df2['lon'],df2['lat']))
    conn.commit()
    cursor.close()
    conn.close()


    However the code does not work and raised the below error:


    psycopg2.ProgrammingError: can't adapt type 'Series'
    ​

    How do I solve the issue?

    Continue reading...

Compartilhe esta Página