การลบ DataFrame ออกจาก cache
เสร็จสิ้นการวิเคราะห์ข้อมูลด้วย DataFrame departures_df แล้ว แต่ยังมีงานประมวลผลอื่นที่ต้องทำต่อ จึงต้องการลบ DataFrame นี้ออกจาก cache เพื่อไม่ให้ใช้หน่วยความจำบน cluster เกินความจำเป็น
มีการกำหนดค่าและ cache DataFrame departures_df ไว้ให้แล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การทำความสะอาดข้อมูลด้วย PySpark
คำแนะนำการฝึกหัด
- ตรวจสอบสถานะการ cache ของ DataFrame
departures_df - ลบ DataFrame
departures_dfออกจาก cache - ตรวจสอบสถานะการ cache อีกครั้ง
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# 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" % ____)