Complete the code to cache the DataFrame named df.
df.[1]()The cache() method stores the DataFrame in memory for faster access.
Complete the code to persist the DataFrame df with MEMORY_AND_DISK storage level.
from pyspark import StorageLevel df.[1](StorageLevel.MEMORY_AND_DISK)
The persist() method allows specifying storage level like MEMORY_AND_DISK.
Fix the error in the code to unpersist the DataFrame df.
df.[1](blocking=True)
The unpersist() method removes the cached or persisted data from memory/disk.
Fill both blanks to cache the DataFrame df and then unpersist it blocking until done.
df.[1]() df.[2](blocking=True)
First, cache() stores the DataFrame in memory. Then, unpersist(blocking=True) removes it and waits until done.
Fill all three blanks to persist df with MEMORY_AND_DISK, then cache it, then unpersist blocking.
from pyspark import StorageLevel df.[1](StorageLevel.MEMORY_AND_DISK) df.[2]() df.[3](blocking=True)
We first persist with MEMORY_AND_DISK, then cache (which is redundant but allowed), then unpersist blocking.