Rahul Diggi
Rahul Diggi

Reputation: 368

How to cast timeUUID to timestamp in PySpark/Python?

I have a column named "occurance" which is a timeuuid in the string form. I want to to be converted/cast to timestamp. I tried couple of methods but couldn't get through it.

enter image description here

from uuid import *
import time_uuid

my_uuid = uuid.UUID(occurrence)
ts = time_uuid.TimeUUID(bytes=my_uuid.bytes).get_timestamp()

But gives this error below: enter image description here

Upvotes: 1

Views: 313

Answers (0)

Related Questions