I'm trying to divide a constant with a column. I know I can do
df.col("col1").divide(90)
but how can I do (90).divide(df.col("col1"))
(obviously this is incorrect).
Thank you!
Use o.a.s.sql.functions.lit
:
lit(90).divide(df.col("col1"))
or o.a.s.sql.functions.expr
:
expr("90 / col1")
Alternatively, this can be used as well
lit(90)/col("col1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With