-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[BUG] Plotly Express (px) pandas datetime with timezone converted to UTC #2311
Comments
I can confirm this behaviour and also perceive it to be a bug |
This comment has been minimized.
This comment has been minimized.
Update: |
I suspect this was introduced in #1934 because pulling the @jonmmease @alexcjohnson @emmanuelle should we fix this? The bug has been in the wild now much longer than the non-buggy code :( |
Also cc @chriddyp would love your input on this one. |
I'm thinking we should fix it... the only plots which will break are those where folks made plots with PX on an hourly-or-smaller timescale and fed in data with timezones but really wanted the plot to be in UTC and relied on the fact that it's automatic, which feels like a small set to me. |
I think I agree we should fix it - px and non-px need to behave the same, and if / when we implement real timezone support in plotly.js the fixed version will still be compatible. |
I should add that this only happens when the input is a pandas datetime column, not a column of ISO strings and not a numpy array of dates or that kind of thing. |
I would favor fixing this since it is a bug with respect to the v4 change log. |
I also think we should fix it. |
Thanks for fixing this I was coming here to file a bug report! |
Similar to what happened in #209 Plotly Express converts the Pandas datetime object to UTC instead of respecting its timezone. If the datetime is a string or is converted to
pydatetime
it works as expected. A reproducible example is available at https://gist.github.com/m0wer/74d5a8901b9499795d13992d29cc2f0c.A workaround (shown in the example) is to convert the datetime column of the Pandas DataFrame to
pydatetime
with:The text was updated successfully, but these errors were encountered: