是否有代码可以清除笔记本的内存?我正在使用for循环将数据帧保存到csv。但是,当循环增加时,运行的内存也会增加。溢出时,笔记本的内核无法工作。谁能告诉我内存增加的原因?我的想法是在不关闭笔记本计算机的情况下清除jupyter内存,这样可以避免内存不足的问题。我想听听其他更好的建议。代码如下。
num = 2062
for date in tqdm(trade_day[num:num+70]):
# data is a dataframe, when saving it to a csv file, the size of file is about 3 to 4 MB
data = alpha(enddate=date, index=stock_list, fq='pre')
data.to_csv(str(date)+'.csv')