unpersist cache pyspark 1

unpersist cache pyspark

df_new = df_cache.cache()
print(df_new.is_cached)
df_new.unpersist()
print(df_new.is_cached)

Here is what the above code is Doing:
1. We create a DataFrame from a CSV file.
2. We cache the DataFrame.
3. We check if the DataFrame is cached.
4. We unpersist the DataFrame.
5. We check if the DataFrame is cached.

Similar Posts