title: PySpark truncate a decimal
body: <p>I'm working in pySpark and I have a variable LATITUDE that has a lot of decimal places. I need to create two new variables from this, one that is rounded and one that is truncated. Both to three decimal places.</p>
  
  <p>What is the simplest way to truncate a value?</p>
  
  <p>For rounding, I did:</p>
  
  <pre><code>raw_data = raw_data.withColumn("LATITUDE_ROUND", round(raw_data.LATITUDE, 3))
  </code></pre>
  
  <p>This seems to work, but let me know if there is a better way.</p>