Ultimate access to all questions.
The following code block contains an error. It is intended to split the managerName
column from DataFrame storesDF
at the space character into two new columns (managerFirstName
and managerLastName
). Identify the error.
A sample of DataFrame storesDF
is shown below:
storeId open openDate managerName
0 true 1100746394 Vulputate Curabitur
1 true 944572255 Tempor Augue
2 false 925495628 Aliquam Et
3 true 1397353092 Faucibus Orci
4 true 986505057 Sed Fermentum
Code block:
storesDF.withColumn("managerFirstName", col("managerName").split(" ").getItem(0))
.withColumn("managerLastName", col("managerName").split(" ").getItem(1))