Repository navigation
Fix for pandas 3.0 - #561
Merged
Merged
Conversation
Contributor
Author
|
Locally |
tompollard
requested changes
Jan 23, 2026
tompollard
left a comment
Member
There was a problem hiding this comment.
thanks @larsoner, please could you remove the print statement?
larsoner
commented
Jan 23, 2026
Contributor
Author
|
Done @tompollard ! |
|
Can we merge and release this PR @tompollard ? It is blocking braindecode and eegdash >.< |
Member
|
Thanks everyone! The fix is now available in the latest release on PyPI (v4.3.1): https://pypi.org/project/wfdb/ |
|
Many thanks 🙏 @tompollard |
This was referenced Oct 23, 2026
tompollard
added a commit
that referenced
this pull request
Nov 2, 2026
…es (#575) Follow-up to #561 (v4.3.1). As analyzed in #574 (with a correction below), the module-level import crash is indeed fixed, but `get_contained_labels` still passes **string** columns' `.values` directly to `set_index`: - `label_map.set_index(label_map["symbol"].values, inplace=True)` - `label_map.set_index(label_map["description"].values, inplace=True)` Under pandas' new string dtype (pandas 3.0, or 2.x with `future.infer_string`), `Series.values` returns an `ArrowStringArrayNumpySemantics`, which `set_index` rejects with `TypeError`. Passing the column label is equivalent on every pandas version and immune to the dtype change. Correction to the analysis in #574 (verified by column dtype + a pandas sandbox): the other `.values` sites listed there (`label_store` columns at ~728/~1325/~1368/~1518/~3232) use **integer** columns, whose `.values` stays a numpy array and passes `set_index` today — they are not currently broken. This PR fixes the two sites that actually raise; the integer-column sites are left untouched to keep the diff minimal (they could be unified cosmetically later if preferred). Verified in a pandas sandbox (`future.infer_string = True`): - `df.set_index(df["str_col"].values)` → `TypeError` (both sites' pattern) - `df.set_index("str_col")` → OK - integer-column variants → OK (unchanged behavior) Fixes #574.
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.
A minimal fix to get
import wfdbworking again with pandas 3.0+. Not sure if others are required. Happy to iterate further with tests etc. as needed, or close if someone else is already working on a fix!Closes #560