从缓存中移除 DataFrame
您已经完成了对 DataFrame departures_df 的分析任务,但还有其他处理要做。您希望将该 DataFrame 从缓存中移除,避免在集群上占用多余内存。
DataFrame departures_df 已为您定义并完成缓存。
本练习是课程的一部分
使用 PySpark 进行数据清洗
练习说明
- 检查
departures_dfDataFrame 的缓存状态。 - 将
departures_dfDataFrame 从缓存中移除。 - 再次验证其缓存状态。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Determine if departures_df is in the cache
print("Is departures_df cached?: %s" % departures_df.____)
print("Removing departures_df from cache")
# Remove departures_df from the cache
____
# Check the cache status again
print("Is departures_df cached?: %s" % ____)