When writing a DataFrame to a csv file, I would like to append to the file, instead of overwriting it.
While pandas DataFrame has the .to_csv()
method with the mode parameter available, thus allowing to append the DataFrame to a file,
None of the Polars DataFrame write methods seem to have that parameter.
with open("out.csv", mode="ab") as f: df.write_csv(f, has_header=False)
– Abijahmode="ab"
exactly? Theb
is also required. – Abijah