Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. fd = spark.createDataFrame([(['0143A'])], ['dt'])
  2. fd.show()
  3.  
  4. +-----+
  5. | dt|
  6. +-----+
  7. |0143A|
  8. +-----+
  9.  
  10. from pyspark.sql.functions import date_format, to_timestamp
  11. #fd.select(date_format('dt','hhmma')).show()
  12. fd.select(to_timestamp('dt','hhmmaa')).show()
  13.  
  14. +----------------------------+
  15. |to_timestamp(`dt`, 'hhmmaa')|
  16. +----------------------------+
  17. | null|
  18. +----------------------------+
  19.  
  20. Expected output: 01:43
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement