so sorry , the matching pattern is rather '^\d*[.]\d*$'
Le dim. 29 mai 2022 à 19:58, marc nicole a écrit :
> Hi,
>
> I think this part of your first line of code*
> ...regexp_replace(col("annual_salary"), "\.", "") *is messing things up,
> so try to remove it.
> Also try to use this numerical
Hi,
I think this part of your first line of code*
...regexp_replace(col("annual_salary"), "\.", "") *is messing things up, so
try to remove it.
Also try to use this numerical matching pattern '^[0-9]*$' in your code
instead
Le dim. 29 mai 2022 à 19:24, Sid a écrit :
> Hi Team,
>
> I need
Hi Sid,
df = df.withColumn("annual_salary",
regexp_replace(col("annual_salary"), "\.", ""))
The value 125.06 becomes 12506 which when cast to double is 12506.00
Have you tried without removing the . ?
df.withColumn("annual_salary",
round(col("annual_salary").cast("double"),
Hi Team,
I need help with the below problem:
https://stackoverflow.com/questions/72422872/unable-to-format-double-values-in-pyspark?noredirect=1#comment127940175_72422872
What am I doing wrong?
Thanks,
Siddhesh