Skip to content

fix: pandas 2.x compatibility — rename, inplace, axis deprecations#150

Open
haoyu-haoyu wants to merge 1 commit intoYerevaNN:masterfrom
haoyu-haoyu:fix/pandas-2x-compatibility
Open

fix: pandas 2.x compatibility — rename, inplace, axis deprecations#150
haoyu-haoyu wants to merge 1 commit intoYerevaNN:masterfrom
haoyu-haoyu:fix/pandas-2x-compatibility

Conversation

@haoyu-haoyu
Copy link
Copy Markdown

Summary

The codebase fails with pandas 2.0+ due to deprecated APIs. This PR fixes 8 issues across 3 files.

Fixes

File Line Issue Fix
preprocessing.py 116 .rename(dict, axis=1) raises ValueError .rename(columns=dict)
preprocessing.py 130 inplace=True deprecated Assignment pattern
preprocessing.py 132 set_index(..., inplace=True) deprecated Assignment pattern
preprocessing.py 101 sort_index(axis=0) explicit axis deprecated sort_index()
subject.py 15 sort_values(..., inplace=True) deprecated Assignment pattern
subject.py 56 sort_values(axis=0) deprecated Remove axis param
subject.py 60 sort_index(axis=0) deprecated Remove axis param
extract_episodes_from_subjects.py 65 sort_index(axis=0) deprecated Remove axis param

All changes are backward compatible with pandas 1.x.

Fixes #138

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)
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.

ValueError: Use .rename to alter labels with a mapper.

1 participant