I list my dataframes to drop unused ones. First I used below function to list dataframes that I found from one of the post
from pyspark.sql import DataFrame
def list_dataframes():
return [k for (k, v) in globals().items() if isinstance(v, DataFrame)]
Then I tried to drop unused ones from the list. Code I used below
df2.unpersist()
When I list again df2 is still there. How can I drop the dataframes to have some memory on pyspark? or do you have any other suggestions? Thank you.