-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Add Pandas 2.0 support #5662
Add Pandas 2.0 support #5662
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5662 +/- ##
=======================================
Coverage 88.29% 88.29%
=======================================
Files 302 302
Lines 62576 62586 +10
=======================================
+ Hits 55253 55263 +10
Misses 7323 7323
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
The datetime change is because Pandas is now beginning to support non-nanosecond precision values: import pandas as pd
from datetime import datetime
s0 = pd.Series([datetime(2020, 1, 1)])
s1 = s0.astype("datetime64[us]")
s2 = s0.astype("int64")
s3 = s1.astype("int64")
print(pd.__version__)
for s in [s0, s1, s2, s3]:
print(f"{s[0]}, {s.dtype}")
print(f"{s.values[0]}, {s.values.dtype}")
print() Outputs: 1.5.3
2020-01-01 00:00:00, datetime64[ns]
2020-01-01T00:00:00.000000000, datetime64[ns]
2020-01-01 00:00:00, datetime64[ns]
2020-01-01T00:00:00.000000000, datetime64[ns]
1577836800000000000, int64
1577836800000000000, int64
1577836800000000000, int64
1577836800000000000, int64
2.0.0rc0
2020-01-01 00:00:00, datetime64[ns]
2020-01-01T00:00:00.000000000, datetime64[ns]
2020-01-01 00:00:00, datetime64[us]
2020-01-01T00:00:00.000000, datetime64[us]
1577836800000000000, int64
1577836800000000000, int64
1577836800000000, int64
1577836800000000, int64 Also beginning to get this warning from xarray because of this: /home/shh/Repos/holoviz/holoviews/holoviews/operation/datashader.py:848: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
agg[ydim] = (agg[ydim]/1e3).astype('datetime64[us]') Can be recreated with: import datetime as dt
import holoviews as hv
from holoviews.operation.datashader import rasterize
rects = hv.Rectangles([(0, dt.datetime(2016, 1, 2), 4, dt.datetime(2016, 1, 3))])
agg = rasterize(rects, width=4, height=4, dynamic=False) |
xarray does not yet support pandas 2.0: pydata/xarray#7716 |
626933a
to
6c6e9ac
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR adds support for Pandas 2.0 and fixes a bug and an inconsistency.
Changes made in this PR:
holoviews/operation/datashader
now usesdatetime[ns]
instead ofdatetime[us]
, for reasons see the comment below.dt_to_int
could return a float in certain cases.setup.py
/setup.cfg
to work with Pandas 2.examples/conftest,py
.Reference: