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

Don't emit a warning when data has timezone in it #5898

Merged
merged 1 commit into from
Sep 21, 2023
Merged

Don't emit a warning when data has timezone in it #5898

merged 1 commit into from
Sep 21, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Sep 21, 2023

Saw this warning in a hvplot notebook:

/home/shh/Repos/holoviz/holoviews/holoviews/core/data/pandas.py:364: FutureWarning: The behavior of DatetimeProperties.to_pydatetime is deprecated, in a future version this will return a Series containing python datetime objects instead of an ndarray. To retain the old behavior, call `np.array` on the result
  dts = [dt.replace(tzinfo=None) for dt in data.dt.to_pydatetime()]

This means that our test did not go down this code path. The fix was simple as I simply used a pandas built-in approach of removing timezone. This also has the advantage that we are not rounding our data to microseconds and also using a vectorized approach.

Added a small test to go down the code path.

@hoxbro hoxbro enabled auto-merge (squash) September 21, 2023 07:05
@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2023

Codecov Report

Merging #5898 (c0d0c58) into main (63a1cda) will increase coverage by 0.00%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5898   +/-   ##
=======================================
  Coverage   88.40%   88.41%           
=======================================
  Files         312      312           
  Lines       64943    64948    +5     
=======================================
+ Hits        57412    57422   +10     
+ Misses       7531     7526    -5     
Flag Coverage Δ
ui-tests 23.33% <14.28%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
holoviews/core/data/pandas.py 94.13% <100.00%> (+0.66%) ⬆️
holoviews/tests/core/data/test_pandasinterface.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hoxbro hoxbro merged commit 2dbf513 into main Sep 21, 2023
11 checks passed
@hoxbro hoxbro deleted the tz_pandas branch September 21, 2023 08:09
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.

2 participants