You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a timezone to a DateTime column using the tz string macro it fails with error UndefVarError: @tz_str not defined.
using Tidier, Dates, TimeZones, DataFrames
df = DataFrame(dt=mdy_hms("9/22/2023 18:45:00"))
# This fails
@chain df begin
@mutate(dt_tz=ZonedDateTime(dt, tz"UTC"))
end
# This works
@chain df begin
@mutate(dt_tz=ZonedDateTime(dt, Dates.TimeZone("UTC")))
end
If one uses DataFramesMeta it works with the @rtransform:
# This works
@chain df begin
@rtransform(:dt_tz=ZonedDateTime(:dt, tz"UTC"))
end
Thanks for the great work :)
The text was updated successfully, but these errors were encountered:
I have a feeling the error may be due to how macros are expanded in side of the mutate() macro. I am not entirely sure the best approach to fix this, but in the mean time another workaround that would mitigate the need to call the full function would be as follows
mytz() = tz"UTC"
@chain df begin
@mutate(dt_tz=ZonedDateTime(dt, mytz()))
end
Hello!
When adding a timezone to a
DateTime
column using thetz
string macro it fails with errorUndefVarError: @tz_str not defined
.If one uses DataFramesMeta it works with the
@rtransform
:Thanks for the great work :)
The text was updated successfully, but these errors were encountered: