Skip to content

Instantly share code, notes, and snippets.

@alecbw
Created September 24, 2020 21:46
Show Gist options
  • Save alecbw/b5e4fb04355d20dd8fe8e14a5bb30388 to your computer and use it in GitHub Desktop.
Save alecbw/b5e4fb04355d20dd8fe8e14a5bb30388 to your computer and use it in GitHub Desktop.
deletes any Pandas DataFrames in memory
import gc
to_delete = []
for name, value in vars().items():
if isinstance(value, pd.DataFrame):
to_delete.append(name)
for item in to_delete:
print(item)
del item
gc.collect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment