Skip to content

Commit 6c5c624

Browse files
use s instead of ns for pandas 3 compatibility
1 parent cd591c5 commit 6c5c624

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rdtools/test/degradation_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_avg_timestamp_old_Pandas(self):
245245
pd.Timestamp("2015-07-01 12:00:00"),
246246
pd.Timestamp("2015-07-02 12:00:00")],
247247
index=self.get_corr_energy(0, 'D').index[-4:],
248-
name='averages', dtype='datetime64[ns, UTC]'
248+
name='averages', dtype='datetime64[s, UTC]'
249249
).tz_localize('UTC')
250250

251251
result = _avg_timestamp_old_Pandas(dt, dt_right).asfreq(freq='D')
@@ -293,7 +293,7 @@ def test_degradation_year_on_year_multi():
293293
rd = -0.005
294294
# Generate a daily time series with 3 years of data
295295
idx = pd.date_range('2017-01-01', '2020-01-01', freq='D', tz='UTC')
296-
daily_rd = 1 - (1 + rd)**(1/365)
296+
daily_rd = (1 + rd)**(1/365) - 1
297297
day_count = np.arange(len(idx))
298298
degradation_derate = (1 + daily_rd) ** day_count
299299
power = 1 - 0.1 * np.cos(day_count / 365 * 2 * np.pi)
@@ -308,7 +308,7 @@ def test_degradation_year_on_year_multi():
308308
assert len(rd_result) == 3
309309
Rd_pct, Rd_CI, calc_info = rd_result
310310
# Check that the result is close to expected degradation
311-
assert np.isclose(Rd_pct * -1, 100 * rd, atol=0.5)
311+
assert np.isclose(Rd_pct, 100 * rd, atol=0.5)
312312
# Check that YoY_values exists and is a Series
313313
assert isinstance(calc_info['YoY_values'], pd.Series)
314314
# Should have more YoY value for multi_yoy than standard

0 commit comments

Comments
 (0)