-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Time slider widget broken for pandas > 1.0.5 #500
Comments
I have run into a similar problem with my package nctoolkit, which relies on hvplot. However, this appears to be some subtle issue with the conda version of Python. The code sample of @marfel fails for me (as do any of my plotting methods that have a time slider) on conda. This is regardless of whether hvplot is installed using conda or pip. However, it is totally fine if I use the version of Python installed on my machine and jupyter notebook installed through pip. So this is potentially a conda bug, not a hvplot bug. |
Interesting... for completeness, my Python version is
|
Appears to be an issue with xarray, I would expect this to work, but it raises the same error: import numpy as np
import pandas
import xarray as xr
a = xr.DataArray(np.arange(27).reshape(3,3,3),
dims=["x", "y", "time"],
coords=dict(x=[1,2,3], y=[1,2,3], time=pd.date_range("2020-01-01", freq="1d", periods=3)))
a.sel(time=a.time.values[0]) Filed an issue with xarray here: pydata/xarray#4377 |
Appears there's already a PR with a fix: pydata/xarray#4292 Hopefully that'll be merged soon. |
Thanks @philippjfr. Very useful. Switching to pandas 1.0.5 seems to solve the problems my package. I'll just have to update the update its website to show how to solve the problem. |
The release notes for pandas 1.1.0 contain a lot of datetime-related stuff. I suspect somewhere along the way the indexing behaviour changed subtly. |
I'm surprised that's not causing xarray's tests to fail on continuous integration. Though that maybe implies it's not affecting that much. Probably very subtle. |
May well be causing test issues, I think xarray 0.16 was released before pandas 1.1 so it wouldn't have been caught at the time. |
True. I think I should worry more about the fact that I currently don't have a way to test plotting in my own package, which would have told me about this a week ago.... |
ALL software version info
Description of expected behavior and the observed behavior
When creating a 2d plot plus slider widget from a 3d dataset, the widget apparently indexes the underlying
xarray
time dimension with a long integer (ie. microseconds), which worked fine withpandas
up to 1.0.5, but now raises aKeyError
.Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
The text was updated successfully, but these errors were encountered: