Skip to content

Commit

Permalink
fix(pm4py): fixed example
Browse files Browse the repository at this point in the history
  • Loading branch information
fit-alessandro-berti committed Apr 12, 2024
1 parent 1be8a7b commit 22609f4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions examples/timestamp_granularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ def execute_script():

# Here are some common options that you can use as a granularity:
#
# 'D': Day
# 'H': Hour
# 'T' or 'min': Minute
# 'S': Second
# 'L' or 'ms': Millisecond
# 'U': Microsecond
# 'N': Nanosecond
# 'h': Hour
# 'min': Minute
# 's': Second
# 'ms': Millisecond
# 'ns': Nanosecond

st = time.time_ns()
# cast on the minute
dataframe["time:timestamp"] = dataframe["time:timestamp"].dt.floor('T')
dataframe["time:timestamp"] = dataframe["time:timestamp"].dt.floor(freq='min')
ct = time.time_ns()

print("required time for the timestamp casting: %.2f seconds" % ((ct-st)/10**9))
Expand Down

0 comments on commit 22609f4

Please sign in to comment.