Skip to content

Navigation Menu

Sign in
Sign up

Cannot find variable or class TZ_NY -> outdated documents or wrong usage? #3953

Unanswered
lzwaan asked this question in Q&A
Discussion options

I tried to follow some documentation examples including the one below from date-time-usage but when executed in docker i got "Cannot find variable or class TZ_NY". Is it correct that the documentation is behind the current development of Deephaven. Like another example where documents describe to import: "from deephaven.time import to_datetime" but cannot be found in the module.

At the moment it is sometimes very difficult to learn deephaven by using outdated documents, or do i miss something completely?

from deephaven import read_csv, time as dhtu
from time import time
min_minutes = 30
num_tries = 100
source = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/MetricCentury/csv/metriccentury.csv")
start = time()
for idx in range(num_tries):
 result_builtin = source.where("minuteOfHour(Time, TZ_NY) > min_minutes")
end = time()
elapsed = (end - start) / num_tries
print(f"Built-in time ops: {(elapsed):.3f} seconds elapsed.")
def only_last_half_hour(timestamp) -> bool:
 return dhtu.minute_of_hour(timestamp, dhtu.TimeZone.NY) > min_minutes
start = time()
for idx in range(num_tries):
 result_python = source.where("only_last_half_hour(Time)")
end = time()
elapsed = (end - start) / num_tries
print(f"Python function: {(elapsed):.3f} seconds elapsed.")
You must be logged in to vote

Replies: 1 comment

Comment options

Hi @lzwaan, sorry for the late response. I somehow missed this question until recently. Hopefully this is no longer an issue.

I believe that, at the time you asked this question, we had just rolled out a major breaking change to our time libary. At that time, the updated docs were in the final stages of review. One of the biggest changes is the use of time zones, especially in the query language. There used to be built-in constant timezones to use, but that's no longer the case. The doc you linked has been updated with the latest correct usage.

from deephaven import read_csv, time as dhtu
from time import time
min_minutes = 30
num_tries = 100
source = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/MetricCentury/csv/metriccentury.csv")
start = time()
for idx in range(num_tries):
 result_builtin = source.where("minuteOfHour(Time, timeZone(`ET`)) > min_minutes")
end = time()
elapsed = (end - start) / num_tries
print(f"Built-in time ops: {(elapsed):.3f} seconds elapsed.")
def only_last_half_hour(timestamp) -> bool:
 return dhtu.minute_of_hour(timestamp, dhtu.time_zone("ET")) > min_minutes
start = time()
for idx in range(num_tries):
 result_python = source.where("only_last_half_hour(Time)")
end = time()
elapsed = (end - start) / num_tries
print(f"Python function: {(elapsed):.3f} seconds elapsed.")
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /