-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View in reticulate shows incorrect time in Data Viewer #1269
Comments
This is quite interesting. Unfortunately, I'm not sure what we could do in reticulate. It looks like the >>> pd.to_datetime('2022-04-26 12:00:00').timestamp()
1650974400.0
>>> pd.to_datetime('2022-04-26 12:00:00', utc = False).timestamp()
1650974400.0
>>> pd.to_datetime('2022-04-26 12:00:00', utc = True).timestamp()
1650974400.0 > as.numeric(as.POSIXct('2022-04-26 12:00:00'))
[1] 1650988800 # different from what python returns
# taking the number from pd.to_datetime().timestamp()
> .POSIXct(1650974400.0)
[1] "2022-04-26 08:00:00 EDT"
> .POSIXct(1650974400.0, "UTC")
[1] "2022-04-26 12:00:00 UTC" This is tricky because the oddity here is in the (e.g., just yesterday: #1265). My advice is to use a more robust parsing approach when creating the datetime objects via pandas methods, e.g, by inject the tz offset directly to the strings. x = ['2022-04-26 12:00:00', '2022-06-14 08:30']
pd.to_datetime([t + "-0400" for t in x]) |
This is very helpful, thank you. |
By the way, changing my timezone environment variable in RStudio (which defaults to my local time zone) fixed the issue. |
if you create a pandas dataframe in reticulate with NO zone information, the Data Viewer changes the time to the local timezone on the machine.
Why is the data viewer changing the time? Also, I did install the latest version of reticulate via Github before running this code.
MOST DISTURBINGLY. When calling the python dataframe in R and saving it as an R object, the incorrect times populate it.
py$s shows the incorrect times.
The text was updated successfully, but these errors were encountered: