Re: Unable to convert double values

2022-05-29 Thread marc nicole
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

Re: Unable to convert double values

2022-05-29 Thread marc nicole
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

Re: Unable to convert double values

2022-05-29 Thread Stelios Philippou
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"),

Unable to convert double values

2022-05-29 Thread Sid
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