Hello @braxx ,
Thanks for the ask and using Microsoft Q&A platform .
You mentioned that the file is CSV , but there is no comma seprated field which you have shared .
You can try the below code .
from pyspark.sql.functions import format_string
df.select('Name',format_string('%.1f',df.Code.cast('float')).alias('converted')).show()
Output :
+----+---------------+
|Name| converted|
+----+---------------+
| AA| 643999989760.0|
| BB|5409999945728.0|
+----+---------------+
Please do let me know how it goes .
Thanks
Himanshu
-----------------------------------------------------------------------------------------------------
- Please don't forget to click on or upvote button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
- Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators