1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to create a new column in sql and fill it with an array on python

Discussão em 'Python' iniciado por Stack, Outubro 7, 2024.

  1. Stack

    Stack Membro Participativo

    I've been searching for 6 hours how to do a simple task done with pandas :

    postal_id = [1, 1, 1, 1, 1, 2, 2, 2, ....]
    df_2["postal_id"] = postal_id


    Pandas creates a new column in the dataframe, and fills the rows with the values shown just before. Why can't sql make this easily ?

    I created another column primary key id_count = (1, 2, 3...) in order to do :

    query = """UPDATE vehicules SET postal_id = %s WHERE id_count = %s;"""
    curB.executemany(query, data)


    with the mysql.connector library and it cannot do the job in 20 minutes. Can someone help me on this, im going crazy. Thank you in advance.

    Continue reading...

Compartilhe esta Página