[Python] UnicodeEncodeError: 'ascii' codec can't encode character 'xa0' in position 586:...

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

  1. Stack

    Stack Membro Participativo

    I'm getting this error while inserting the data into the table. result_df has a column which contains different languages text in it and I tried to use encode('utf-8') but no use . I used following code:

    result_df.Column_Name.str.encode('utf-8')
    data1=result_df.values.tolist()
    conn = connection.__open__()
    cursor = conn.cursor()
    sqlstmt = 'SQL_stmt'
    cursor.executemany(sqlstmt, data1).
    conn.commit()


    any advices on this is appreciated

    Continue reading...

Compartilhe esta Página