It's not as straightforward in Python as it is in R. The best and safest option is to manually del
each dataframe by name (as well as any other references to the object, e.g. if they are also in a list). However, if this isn't an option, you can iterate through all available variables, check if they are an instance of a pandas
Dataframe, and then delete them.
If your goal is to free memory, you should manually run garbage collection after references to the objects have been deleted.
The following works for me:
import gc
import pandas as pd
for i in dir():
if isinstance(globals()[i], pd.DataFrame):
del globals()[i]
gc.collect()