Fix logical bugs and prepare for Pandas 3.0 compatibility#7
Draft
Fix logical bugs and prepare for Pandas 3.0 compatibility#7
Conversation
- Fix empty DataFrame check: Changed `if len(df) < 0:` to `if len(df) == 0:` in adifgraph.py - Fix exception handling: Changed `except ModuleNotFoundError or ImportError:` to `except (ModuleNotFoundError, ImportError):` in both files - Add robust date parsing with `errors='coerce'` to handle invalid dates - Add dropna to remove NaT values after date parsing - Replace deprecated is_period_dtype with isinstance check using pd.PeriodDtype Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix potential bugs and improve date parsing in adifgraph.py
Fix logical bugs and prepare for Pandas 3.0 compatibility
Feb 16, 2026
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.
Fixes several logical bugs in date parsing and exception handling, while preparing the codebase for Pandas 3.0 API changes.
Changes
Logical bug fixes:
len(df) < 0→len(df) == 0(length cannot be negative)except A or B:→except (A, B):(incorrect Python syntax only caught first exception)Date parsing robustness:
errors='coerce'topd.to_datetime()to convert invalid dates to NaT instead of raisingdropna(subset=['QSO_DATE'])after parsing to filter out invalid datesPandas 3.0+ compatibility:
is_period_dtype()withisinstance(dtype, pd.PeriodDtype)per pandas deprecation warningExample
Affected Files
adiftools/adifgraph.py: 3 functions (monthly_qso, band_percentage, monthly_band_qso)adiftools/adiftools.py: 4 import statementsOriginal prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.