-
Notifications
You must be signed in to change notification settings - Fork 8
Fix FutureWarning in zscore by casting to float32 #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolves a pandas FutureWarning that occurs when assigning a float64 result to a float32 DataFrame column. The `zscore` method in `eegdash/features/datasets.py` was performing a calculation that resulted in a float64 dtype. When this was assigned back to the DataFrame, which has a float32 dtype, a FutureWarning was raised. This change explicitly casts the result of the z-score calculation to `float32` before assignment, ensuring dtype compatibility and silencing the warning. A new test was added to `tests/test_features.py` to verify that the `zscore` method correctly maintains the float32 dtype.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. |
|
The feature module doesn't work with Python 3.10, but we support Python 3.10. It is mainly because of this type of attribution: ==================================== ERRORS ==================================== |
Thank you for catching this! You are correct, the syntax was not compatible with Python 3.10. I have now updated the code to use a backward-compatible indexing method. This should resolve the |
This commit addresses two separate issues: 1. Resolves a pandas FutureWarning in the `zscore` method by explicitly casting the result of the z-score calculation to `float32` before assignment. This ensures dtype compatibility and silences the warning. A new test was added to verify this fix. 2. Fixes a `SyntaxError` in `eegdash/features/feature_bank/complexity.py` that occurred in Python 3.10. The indexing syntax was updated to be backward-compatible, ensuring the feature module works correctly on all supported Python versions.
This change resolves a pandas
FutureWarningin thezscoremethod of theFeaturesConcatDatasetclass. The warning was triggered by an incompatible dtype assignment. The fix involves explicitly casting the result of the normalization tofloat32before assigning it back to the DataFrame. A targeted unit test has been added to verify the fix and prevent future regressions.PR created automatically by Jules for task 355021486991017514