How to concatenate multiple pandas.DataFrames without running into MemoryError

后端 未结 10 1357
盖世英雄少女心
盖世英雄少女心 2020-12-24 12:19

I have three DataFrames that I\'m trying to concatenate.

concat_df = pd.concat([df1, df2, df3])

This results in a MemoryError. How can I re

10条回答
  •  一向
    一向 (楼主)
    2020-12-24 13:03

    I've had a similar performance issues while trying to concatenate a large number of DataFrames to a 'growing' DataFrame.

    My workaround was appending all sub DataFrames to a list, and then concatenating the list of DataFrames once processing of the sub DataFrames has been completed. This will bring the runtime to almost half.

提交回复
热议问题