A visualizing code consumes 1gb+ of ram memory and notebook gets unresponsive. Is there any solution to remove it from memory without hurting other codes?. Restarting kernel isn't fruitful. Thank you
I had 6GB files for Pandas handling and cleaning. In a loop execution from file folder each next file was processed two times slower than the previous one (43 min, 86, 125, 254 min, etc.). Restarting kernel was not an option. I just added one line for deleting variable (Pandas dataframe in my case) on the bottom of each cell. It solves the day for me!
import pandas as pd
data = pd.read_csv('file_name.csv')
#any amount of lines for your actions
#after the next line memory becomes clean and ready to start with a new cell. The same approach at the end of a loop.
del data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.