enh: relax constraints on pandas version - #286
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.