Spark SQL change format of the number

Viewed 41337

After show command spark prints the following:

+-----------------------+---------------------------+
|NameColumn             |NumberColumn               |
+-----------------------+---------------------------+
|name                   |4.3E-5                     |
+-----------------------+---------------------------+

Is there a way to change NumberColumn format to something like 0.000043?

3 Answers

In newer versions of pyspark you can use round() or bround() functions. Theses functions return a numeric column and solve the problem with ",".

it would be like:

df.withColumn("NumberColumn", bround("NumberColumn",5))
Related