Which of the following code blocks returns a new DataFrame from DataFrame storesDF where column modality is the constant string "PHYSICAL"? Assume DataFrame storesDF is the only defined language variable.
Which of the following code blocks returns a new DataFrame from DataFrame storesDF where column modality is the constant string "PHYSICAL"? Assume DataFrame storesDF is the only defined language variable.
To return a new DataFrame where the column 'modality' is set to the constant string 'PHYSICAL', you need to use the 'withColumn' method along with the 'lit' function to create a column with a constant value. The correct code block is 'storesDF.withColumn("modality", lit("PHYSICAL"))'. This correctly assigns the constant string 'PHYSICAL' to the 'modality' column.
should be C