Casting a new derived column in a DataFrame from boolean to integer
Expression you use evaluates to column so you can cast directly like this:
x.withColumn('y', ((x.a-x.b) / x.c > 1).cast('integer')) # Or IntegerType()
Expression you use evaluates to column so you can cast directly like this:
x.withColumn('y', ((x.a-x.b) / x.c > 1).cast('integer')) # Or IntegerType()