Pandas GroupBy memory deallocation

前端 未结 2 919
孤独总比滥情好
孤独总比滥情好 2021-02-07 04:28

Problem

I noticed that memory allocated while iterating through a Pandas GroupBy object is not deallocated after iteration. I use resource.getrusage(resource.RUSA

2条回答
  •  清歌不尽
    2021-02-07 04:49

    Why is memory for DataFrames resulting from iteration through the groupby not deallocated after iteration is completed?

    Nowhere in your code you del object gb, which means at the end it's still there. One thing is to have an iterator reach the end of its cycle, then I would expect it to die automagically, but the object that gave rise to the iterator persists, in case you need to do something else (iterate again, aggregate, etc).

提交回复
热议问题