1

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

Rahul Diggi
  • 288
  • 2
  • 16
  • Are you sure `time-uuid` module is installed, e.g. by running `pip install time-uuid`? – Alex Aug 05 '22 at 11:54
  • An error was encountered: invalid syntax (, line 1) File "", line 1 pip install time uuid ^ SyntaxError: invalid syntax – Rahul Diggi Aug 05 '22 at 11:56
  • I am running this in EMR Notebook – Rahul Diggi Aug 05 '22 at 12:01
  • I'm not at all a PySpark expert, but the error likely tells you don't have this module installed. **Take a backup** and try to find out a way to install the `time-uuid` module. This answer looks promising: https://stackoverflow.com/questions/36217090/how-do-i-get-python-libraries-in-pyspark – Alex Aug 05 '22 at 12:39
  • 1
    jupyter notebooks let you run shell commands using the `!` prefix in the cell. to install use `!pip install ` – samkart Aug 05 '22 at 13:30

0 Answers0