fix: pandas 2.x compatibility — rename, inplace, axis deprecations#150
Open
haoyu-haoyu wants to merge 1 commit intoYerevaNN:masterfrom
Open
fix: pandas 2.x compatibility — rename, inplace, axis deprecations#150haoyu-haoyu wants to merge 1 commit intoYerevaNN:masterfrom
haoyu-haoyu wants to merge 1 commit intoYerevaNN:masterfrom
Conversation
8 fixes across 3 files for pandas 2.0+ compatibility: preprocessing.py: - .rename(dict, axis=1) → .rename(columns=dict) - Remove inplace=True from rename() and set_index() - Remove axis=0 from sort_index() (default) subject.py: - Remove inplace=True from sort_values() - Remove axis=0 from sort_values() and sort_index() scripts/extract_episodes_from_subjects.py: - Remove axis=0 from sort_index() Fixes YerevaNN#138 (ValueError with pandas 2.x rename API)
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.
Summary
The codebase fails with pandas 2.0+ due to deprecated APIs. This PR fixes 8 issues across 3 files.
Fixes
preprocessing.py.rename(dict, axis=1)raises ValueError.rename(columns=dict)preprocessing.pyinplace=Truedeprecatedpreprocessing.pyset_index(..., inplace=True)deprecatedpreprocessing.pysort_index(axis=0)explicit axis deprecatedsort_index()subject.pysort_values(..., inplace=True)deprecatedsubject.pysort_values(axis=0)deprecatedsubject.pysort_index(axis=0)deprecatedextract_episodes_from_subjects.pysort_index(axis=0)deprecatedAll changes are backward compatible with pandas 1.x.
Fixes #138