Mit Python eine CSV Datei modifizieren (löschen)

mport pandas as pd
import os

directory = '.'

for filename in os.listdir(directory):
    if filename.endswith(".csv") and not filename.startswith('changed_'):
        
        input_file = filename
        output_file = "changed_" + filename

        if not os.path.exists(output_file):
            print(input_file)
            print(output_file)
            df = pd.read_csv(input_file, usecols=range(6))
            dfnew = df.drop('Comment', axis=1)
            export_csv = dfnew.to_csv (output_file, index = None, header=True)

Keine Kommentare:

Kommentar veröffentlichen

Datei in einer windows.wim image ändern

 Um Dateien in einer Datei.wim zu ändern, und zwar nicht im 1. Index sondern 2. öffnet man Powershell (ich habs jetzt im admin Modus gestart...