[Python] Reading AWS S3 CSV file in Python with Backslash "\" in column data(as last Character)

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have a CSV file in AWS S3 bucket, which is having below sample data.

    First_name job_level
    Andrew \ SSE
    Kyle SE

    while loading csv file to pandas, this is giving me error as the

    End of record reached while expected to parse column ["job_level":2]


    I tried to replace "\" from above data using csv_data.replace(r'\\', '') and csv_data.replace(r'\,', ','). This is not working as this is giving me below result while printing

    First_Name Job_level
    Andrew,SSE Nan
    Kyle SE

    ** Expected Result:**

    First_Name Job_level
    Andrew SSE
    Kyle SE

    Continue reading...

Compartilhe esta Página