Skip to content

Commit

Permalink
Remove patches post dependency fixes
Browse files Browse the repository at this point in the history
- lifts xfail from `test_monthly_freq`.
- removes patch in `helpers.resample` explained in
4a3e2de#diff-9bd6a7492809b04d13da665b8ae7d2fc75fae79930be1216fa77dc040fd2d3b1R381
  • Loading branch information
maread99 committed Sep 22, 2024
1 parent 12ba274 commit a85fc00
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 21 deletions.
10 changes: 0 additions & 10 deletions src/market_prices/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/market_prices/prices/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,6 @@ def test_volume_to_na(intraday_pt, intraday_pt_ss):
assert_frame_equal(rtrn, df)


# TODO Remove xfail when pandas >2.2 released
# NB pd bug manifests in test, not package (manifests where evaluate
# `expected_ooo.index = df[::12]`)
# 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_resample(intraday_pt):
"""Test `resample`.
Expand Down
5 changes: 0 additions & 5 deletions tests/test_pt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a85fc00

Please sign in to comment.