You can append using to_csv
by passing a file which is open in append mode:
with open(file_name, 'a') as f:
df.to_csv(f, header=False)
Use header=None
, so as not to append the column names.
In fact, pandas has a wrapper to do this in to_csv
using the mode
argument (see Joe's answer):
df.to_csv(f, mode='a', header=False)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…