Reputation: 1
Failure: OSError: [Errno 9] Bad file descriptor
Python can not find the path!!
import pandas as pd
import csv
def read_csv_auto_header(file_path):
# Öffnen der CSV-Datei und Lesen der Daten mit dem csv.reader
# CSV-Datei in DataFrame lesen
df = pd.read_csv(file_path, encoding='ISO-8859-1', sep=';')
# Ersetzen von mehrstelligen Leerzeichen durch ein Leerzeichen
df = df.replace('\s+', ' ', regex=True)
df.to_csv(r'D:\Markus\00_Documents\20_Bildung\60_Self_Online_Study\60_Programmieren\Projekte\CreditKonto_analysing\neue_datei.csv',index=False,header=True)
# Beispielverwendung
file_path = 'Buchung.csv' # Ersetze 'Buchung.csv' durch deinen Dateipfad zur CSV-Datei
read_csv_auto_header(file_path)
different coding of the path
How can I solve the issue?
Upvotes: -1
Views: 108
Reputation: 1
I hope your problem will be solved.
Upvotes: 0