alphatims
alphatims copied to clipboard
fix: replace chained pandas indexing with .loc accessor
Pull Request description
fix: replace chained pandas indexing with .loc accessor
- Resolves FutureWarning: ChainedAssignmentError warnings by using proper pandas DataFrame indexing methods.
- This change makes the code compatible with pandas 3.0's upcoming Copy-on-Write behavior.
Which issue this PR aims to resolve or fix?
Fixes #283
How to test these changes
- Run the code that previously triggered ChainedAssignmentError warnings.
- Verify that the warnings are no longer present.
Pull Request checklists
This PR is a:
- [x] bug-fix
- [ ] new feature
- [ ] maintenance
About this PR:
- [x] it includes tests.
- [ ] the tests are executed on CI.
- [ ] the tests generate log file(s) (path).
- [x] pre-commit hooks were executed locally.
- [ ] this PR requires a project documentation update.
Author's checklist:
- [x] I have reviewed the changes and it contains no misspelling.
- [x] The code is well commented, especially in the parts that contain more complexity.
- [x] New and old tests passed locally.
Additional information
Reviewer's checklist
Copy and paste this template for your review's note:
## Reviewer's Checklist
- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved.