Created
September 24, 2020 21:46
-
-
Save alecbw/b5e4fb04355d20dd8fe8e14a5bb30388 to your computer and use it in GitHub Desktop.
deletes any Pandas DataFrames in memory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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