title: Convert String to decimal (18, 2) in pyspark dataframe
body: <p>Converting String to Decimal (18,2)</p>
  <pre><code>from pyspark.sql.types import *
  
  DF1 = DF.withColumn(&quot;New_col&quot;, DF[&quot;New_col&quot;].cast(DecimalType(12,2)))
  
  display(DF1)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/knJTU.png" rel="nofollow noreferrer">expected and actual O/P i see</a></p>
  <p>Need help in converting the String to decimal to load the DF into Database.</p>