In my python script I am reading a csv file via
df = pd.read_csv('input.csv', sep=';', encoding = "ISO-8859-1", skiprows=2, skipfooter=1, engine='python')
I am the skipping the first two rows in the csv file because they are just discriptions I don't need.
After importing, I am filtering and separating the data. I want to write the data back to csv files while having the same format as before (first two rows either empty or the description as before the import). How can I do that?
Currently I am using
df.to_csv('output.csv'), sep=';', encoding = "ISO-8859-1")
Is there something like a parameter "skiprows" for exporting? I can't find one in the api documentation for .to_csv.
pandas
for this – Proctormode='a'
for appending when writing csv. So I just need to create a csv file with two empty rows before exporting. – Remandpandas
to do this usingto_csv
– Proctor