pandas DataFrame output end of csv

后端 未结 4 2056
死守一世寂寞
死守一世寂寞 2020-11-29 22:18

I wonder how to add new DataFrame data onto the end of an existing csv file? The to_csv doesn\'t mention such functionality.

4条回答
  •  广开言路
    2020-11-29 23:03

    Thank to Andy, the complete solution:

    f = open(filename, 'a') # Open file as append mode
    df.to_csv(f, header = False)
    f.close()
    

提交回复
热议问题