
Ultimate access to all questions.
A data scientist is working on one-hot encoding categorical attributes in a PySpark DataFrame named 'features_df' using Spark ML. The string column names are stored in the variable 'input_columns'. The provided code snippet is causing an error. What change is necessary to correctly perform one-hot encoding?
A
The 'method' parameter must be explicitly defined in the OneHotEncoder.
B
The 'fit' operation line should be deleted from the code.
C
StringIndexer should be applied to the categorical attributes before one-hot encoding.
D
The output columns must have the same names as those in 'input_columns'._