Skip to content

enh: relax constraints on pandas version - #286

Merged
fedorov merged 3 commits into
ImagingDataCommons:mainfrom
fedorov:relax-pandas
Jul 31, 2026
Merged

enh: relax constraints on pandas version#286
fedorov merged 3 commits into
ImagingDataCommons:mainfrom
fedorov:relax-pandas

Conversation

@fedorov

@fedorov fedorov commented Jul 31, 2026

Copy link
Copy Markdown
Member

No description provided.

fedorov and others added 3 commits July 31, 2026 12:28
The previous cap (`pandas<=2.2.4`, effectively 2.2.3 since 2.2.4 was never
released) was inherited from the original cookiecutter scaffolding rather
than motivated by any incompatibility. idc-index uses a small, conservative
slice of the pandas API (read_parquet, read_csv, merge, concat, groupby.agg,
the .str accessor) with no chained assignment or removed APIs, so nothing in
the codebase requires the cap.

Verified the full test suite (42 tests, 17 subtests, with
filterwarnings=error so new FutureWarnings fail) against:

  - Python 3.12 + pandas 2.2.3 (previous cap)  -> pass
  - Python 3.10 + pandas 2.3.3                 -> pass
  - Python 3.12 + pandas 3.0.5                 -> pass

The floor of 2.2.2 is the first pandas release compatible with numpy 2,
which pyarrow and duckdb now pull in; pandas 2.0.3 fails at import under
numpy 2 with "numpy.dtype size changed".

Note for users: under pandas 3, string columns in returned DataFrames use
StringDtype rather than object dtype.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two latent bugs, both independent of the pandas version (reproduced
identically on 2.2.3 and 3.0.5), surfaced while testing newer pandas:

- get_series_size() compared a list literal to a string
  (`self.index[["SeriesInstanceUID"] == seriesInstanceUID]`), which
  evaluates to False and made every call raise `KeyError: False`. It now
  goes through _filter_dataframe_by_id, which also raises the ValueError
  for unknown UIDs that the docstring already promised. No test covered
  this method.

- The instance-level URL fallback used `Series.replace("/*", "/")`, which
  matches whole values rather than substrings and was therefore a no-op,
  leaving the trailing "*" in the URL. Replaced with
  `.str.removesuffix("*")`, matching the scalar idiom already used in
  get_instance_file_URL.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fedorov
fedorov merged commit d5399f5 into ImagingDataCommons:main Jul 31, 2026
11 checks passed
@fedorov
fedorov deleted the relax-pandas branch July 31, 2026 17:20
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.

1 participant