Which of the following code blocks returns a new DataFrame with a new column employeesPerSqft that is the quotient of column numberOfEmployees and column sqft, both of which are from DataFrame storesDF? Note that column employeesPerSqft is not in the original DataFrame storesDF.
A. storesDF.withColumn("employeesPerSqft", col("numberOfEmployees") / col("sqft"))
B. storesDF.withColumn("employeesPerSqft", "numberOfEmployees" / "sqft")
C. storesDF.select("employeesPerSqft", "numberOfEmployees" / "sqft")
D. storesDF.select("employeesPerSqft", col("numberOfEmployees") / col("sqft"))
E. storesDF.withColumn(col("employeesPerSqft"), col("numberOfEmployees") / col("sqft"))
Which of the following code blocks returns a new DataFrame with a new column employeesPerSqft that is the quotient of co
-
- Site Admin
- Posts: 899589
- Joined: Mon Aug 02, 2021 8:13 am