From 2366ab331132b7441709231c02fa4a29304fca49 Mon Sep 17 00:00:00 2001 From: Marcus Read Date: Sun, 22 Sep 2024 19:16:21 +0100 Subject: [PATCH] Remove patches post dependency fixes - lifts xfail from `test_monthly_freq`. - removes patch in `helpers.resample` explained in https://github.com/maread99/market_prices/commit/4a3e2dea3594b09d23c6febe087a942954994e6f#diff-9bd6a7492809b04d13da665b8ae7d2fc75fae79930be1216fa77dc040fd2d3b1R381 --- src/market_prices/helpers.py | 10 ---------- src/market_prices/prices/base.py | 2 +- tests/test_pt.py | 5 ----- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/market_prices/helpers.py b/src/market_prices/helpers.py index d1ccb53..15babc7 100644 --- a/src/market_prices/helpers.py +++ b/src/market_prices/helpers.py @@ -378,16 +378,6 @@ def resample( resampler = resample_me.resample(rule, closed="left", label="left", origin=origin) resampled = resampler.agg(agg_f) - - # NOTE START... required for at least pandas 2.1.0. - # See https://github.com/pandas-dev/pandas/issues/55064 - offset = pdutils.pdfreq_to_offset(rule) if isinstance(rule, str) else rule - first_index = data.index[0] if nominal_start is None else nominal_start - cut_off = first_index - offset - if resampled.index[0] <= cut_off: - resampled = resampled[resampled.index > cut_off] - # required for at least pandas 2.1.0. ...END - resampled.columns = columns_ resampled = volume_to_na(resampled) return resampled diff --git a/src/market_prices/prices/base.py b/src/market_prices/prices/base.py index 0f5d9a3..c3d9be6 100644 --- a/src/market_prices/prices/base.py +++ b/src/market_prices/prices/base.py @@ -3298,7 +3298,7 @@ def get( Coerce(pd.Timestamp), ] = None, end: Annotated[ - pd.Timestamp |str | datetime.datetime | int | float | None, + pd.Timestamp | str | datetime.datetime | int | float | None, Coerce(pd.Timestamp), ] = None, minutes: int = 0, diff --git a/tests/test_pt.py b/tests/test_pt.py index 63f5cde..fd98771 100644 --- a/tests/test_pt.py +++ b/tests/test_pt.py @@ -2140,11 +2140,6 @@ def test_cbday_freq(self, daily_pt_ss, xnys): df.pt.downsample("3d", xnys), ) - # TODO Remove xfail when pandas >2.2 released - # NB pd bug manifests in test, not package (manifests where takes a slice to - # evaluate 'subset'). - # pandas issue ref is https://github.com/pandas-dev/pandas/issues/58604 - @pytest.mark.xfail(reason="Known pd issue with py3.12, should resolve with pd>2.2") def test_monthly_freq(self, daily_pt, xnys, x247, one_day, symbols): """Verify "MS" and "QS" frequencies.""" df = daily_pt