Skip to content

fix: pandas 3.0 compatibility (frequency alias migration) - #6

Merged
tiago-hansen merged 1 commit into
mainfrom
fix/pandas-3-minute-freq-alias
Jul 10, 2026
Merged

tiago-hansen merged 1 commit into
mainfrom
fix/pandas-3-minute-freq-alias

Conversation

@tiago-hansen

Copy link
Copy Markdown
Collaborator

Problem

On a fresh clone + pip install -e ".[dev]", the dependency resolver installs pandas 3.0 (the pandas floor was >=1.3.6 with no upper bound). pandas 3.0 removed the long-deprecated single-letter offset aliases, which breaks the financial-analysis and data-processing code paths.

Symptom: 26 errors in tests/integration/test_flask_run_simulation.py, e.g.:

ValueError: Invalid frequency: T. ... Did you mean min?
ValueError: 'M' is no longer supported for offsets. Please use 'ME' instead.

Fix

Migrate the removed aliases to their pandas-2.2+ equivalents:

Old New Where
freq="T" freq="min" 8 pd.date_range call sites
resample("M") / "M" period literals "ME" financial_analysis_functions.py
freq="H" / resample("1H") "h" / "1h" historic_data_utils.py

"D" and "W" are unchanged (still valid in pandas 3.0). The new aliases require pandas ≥2.2, so the pandas floor is bumped to >=2.2 in both pyproject.toml and setup.py.

Also adds venv/ and .venv/ to .gitignore (an in-repo virtualenv was otherwise showing up as untracked).

Testing

Fast suite (pytest -m "not slow"):

  • Before: 1477 passed, 26 errored
  • After: 1503 passed, 2 xfailed, 0 errors

The 26 previously-failing Flask integration tests now pass.

pandas 3.0 removed the deprecated single-letter offset aliases, which
broke the financial-analysis and data-processing code paths (26 errors
in the Flask simulation integration tests on a fresh install, since
pip resolves pandas to 3.x with no upper bound).

Replace the removed aliases with their 2.2+ equivalents:
  - freq="T"  -> freq="min"   (8 date_range call sites)
  - resample("M") / "M" period literals -> "ME"
  - freq="H" / resample("1H") -> "h" / "1h"

Bump the pandas floor to >=2.2 in pyproject.toml and setup.py, since
the "min"/"ME"/"h" aliases require pandas 2.2+. Also add venv/ and
.venv/ to .gitignore so a locally-created virtualenv is not tracked.

Full fast test suite: 1503 passed, 2 xfailed (was 1477 passed + 26
errored before the fix).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tiago-hansen
tiago-hansen requested a review from mendesfabio July 10, 2026 17:14
@tiago-hansen
tiago-hansen merged commit c6326b8 into main Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants