score:1

Accepted answer

scala syntax for selecting column is different from python. try using parenthesis instead of square brackets:

result.withcolumn("convertedvalue", result("count")*result("converted")).show

score:1

you can use the operators as below:

import spark.implicits._
result.withcolumn("convertedvalue", $"count" * $"converted")

score:1

import spark.implicits._
result.withcolumn("convertedvalue", 'count * 'converted)

Related Query

More Query from same tag