I have the below dataframe.
column_1
2.1
-3.4
-1.1
2.5
I want to convert this column to positive numbered column when the value is less than 0 or in other words if its negative value. Input is in decimal format and output should also be in decimal format.
I tried converting to string and using abs(column_1) when lt(0) and then cast it as decimal. But all values are getting converted to null.
Any idea how to achieve this in Java spark.
Required output:
column_1
2.1
3.4
1.1
2.5
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.