Skip to content

Commit

Permalink
fix for pandas new ME alias to allow pandas<2
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-springer committed Sep 25, 2024
1 parent d534011 commit 57e5131
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions rdtools/availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ def _combine_losses(self, rollup_period="ME"):
The period on which to roll up losses and calculate availability.
"""

# Allow pandas < 2.0 to use 'M' as an alias for MonthEnd
# https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#deprecate-aliases-m-q-y-etc-in-favour-of-me-qe-ye-etc-for-offsets
if rollup_period == "ME":
rollup_period = pd.tseries.offsets.MonthEnd()

if ((self.loss_system > 0) & (self.loss_subsystem > 0)).any():
msg = (
'Loss detected simultaneously at both system and subsystem '
Expand Down
2 changes: 1 addition & 1 deletion requirements-min.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
matplotlib==3.5.3
numpy==1.22.4
pandas==1.5.3
pandas==1.4.4
statsmodels==0.13.5
scipy==1.8.1
h5py==3.7.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
INSTALL_REQUIRES = [
"matplotlib >= 3.5.3",
"numpy >= 1.22.4",
"pandas >= 1.5.3",
"pandas >= 1.4.4",
"statsmodels >= 0.13.5",
"scipy >= 1.8.1",
"h5py >= 3.7.0",
Expand Down

0 comments on commit 57e5131

Please sign in to comment.