如何使用 Python 和 Pandas 创建比 RAM 大的 csv 文件

How to create csv file bigger than you RAM using Python and Pandas

如何使用 Python(可能 Pandas)创建比我的 RAM 内存更大的 CSV 文件?我正在考虑 'append to csv' 之类的东西,而不会将整个 csv 文件加载到内存中。

您可以打开文件对象并将数据帧连续写入该对象

with open('final.csv', 'a') as f:
    while True:
        #code to create df and break when finished
        df.to_csv(f)