[Python] What can be the error and how do I solve it?

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I have a csv file,

    "==CNAME=="
    ""
    "Tool Name","v2.1"
    "Name:","MATT B"
    "E-Mail:","MATTB@EMAIL.COM"
    "Phone Number:","987654321"
    ""


    while running the following script,

    import pandas as pd
    import os

    def convert_csv_to_xlsx(csv_file_path):
    csv_file = r"C:\Users\aztec\Desktop\del.csv"
    df_csv = pd.read_csv(csv_file)
    excel_file = os.path.splitext(csv_file)[0] + '.xlsx'
    df_csv.to_excel(excel_file, index=False)
    return excel_file


    I get the following error,

    Error reading the CSV file, Error tokenizing data. C error: Expected 1 fields in line 3, saw 2


    I tried specifying delimiters, Same error persists. I want to know why this is happening and how to resolve this

    Continue reading...

Compartilhe esta Página