Skip to content
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

fix PX timezone treatment #2749

Merged
merged 1 commit into from
Sep 8, 2020
Merged

fix PX timezone treatment #2749

merged 1 commit into from
Sep 8, 2020

Conversation

nicolaskruchten
Copy link
Contributor

@nicolaskruchten nicolaskruchten commented Sep 5, 2020

Closes #2311 essentially by removing calls to pd.Series.values, which seems to always convert datetimes to UTC.

  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.

@nicolaskruchten
Copy link
Contributor Author

Ok this all works on my machine but fails all over CI. Looks like my approach is too brittle :)

@nicolaskruchten
Copy link
Contributor Author

New approach succeeded: do everything in pandas-land instead of transiting through numpy-land at all :)

Ready for review!


[testenv:py36-core]
basepython={env:PLOTLY_TOX_PYTHON_36:}
commands=
python --version
pytest {posargs} -x plotly/tests/test_core
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove the -x ? Exiting on first failing test is good for the environment :-).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to be able to see if I fixed a test even if an "earlier" one failed. Looking at the timings, it seems to me that the container setup etc takes more time than the test suites proper, so while we have the container spun up we may as well extract as much information as possible about the run, is my feeling :)

seems to mangle datetime columns. Stripping the index from existing pd.Series is
required to get things to match up right in the new DataFrame we're building
"""
return pd.Series(x).reset_index(drop=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes a copy of the series because of the reset_index step, so it's suboptimal for non datetime columns. Could a solution be to return x.values in other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm yeah we weren't copying before but we are now. After spending like 8 hours trying various permutations here I think I'm OK with the copy on the principle of "make it correct, then make it fast". We can optimize it later if this really causes problems.

@nicolaskruchten nicolaskruchten merged commit 3601322 into master Sep 8, 2020
@archmoj archmoj deleted the px_tz_fix branch November 23, 2021 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Plotly Express (px) pandas datetime with timezone converted to UTC
2 participants