Skip to content

fix: guard string index operations against negative wraparound#217

Open
github-actions[bot] wants to merge 2 commits into
nodatesfrom
fix/plot-string-and-datetime
Open

fix: guard string index operations against negative wraparound#217
github-actions[bot] wants to merge 2 commits into
nodatesfrom
fix/plot-string-and-datetime

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR fixes string index operations in plot_pytrendy.py:

  • Add _safe_adjacent() helper function for bounds-safe index access
  • Guard all get_loc()±1 operations against out-of-bounds wraparound (prevents negative index wraparound)
  • Fix string mask to use positional slicing for correct row selection
  • Enable change-rank annotation for string indexes (was previously skipped)
  • Add datetime64 to accepted index types (treated as date)

All tests pass after these changes.

- Add _safe_adjacent() helper function for bounds-safe index access
- Guard all get_loc()±1 operations against out-of-bounds wraparound
- Fix string mask to use positional slicing for correct row selection
- Enable change-rank annotation for string indexes
- Add datetime64 to accepted index types (treated as date)
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

📚 Docs preview deployed!

Your docs preview is available at: https://russellsb.github.io/pytrendy/pr-217/

This preview will be removed when the PR is closed.

github-actions Bot added a commit that referenced this pull request Jul 9, 2026
@github-actions
github-actions Bot removed the request for review from RussellSB July 9, 2026 07:18
github-actions Bot added a commit that referenced this pull request Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pytrendy/io/plot_pytrendy.py 40.00% 15 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant