Skip to content

refactor: extract index detection and boundary remapping from detect_trends#216

Open
github-actions[bot] wants to merge 2 commits into
nodatesfrom
refactor/detect-trends-helpers
Open

refactor: extract index detection and boundary remapping from detect_trends#216
github-actions[bot] wants to merge 2 commits into
nodatesfrom
refactor/detect-trends-helpers

Conversation

@github-actions

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

Copy link
Copy Markdown
Contributor

This PR refactors the index detection logic in detect_trends.py:

  • Extract _detect_index_type() helper function for index type detection
  • Fix index_lookup construction to use positional zip (was label-based, which broke on non-RangeIndex inputs)
  • Use dedicated _pytrendy_idx scratch column instead of overwriting date_col
  • Remove duplicate import warnings and unused imports
  • Fix docstring typos: timestamps → dates, segmenets → segments

All tests pass after these changes.

…trends

- Extract _detect_index_type() helper function for index type detection
- Fix index_lookup construction to use positional zip (was label-based)
- Use dedicated _pytrendy_idx scratch column instead of overwriting date_col
- Remove duplicate import warnings and unused imports
- Fix docstring typos: timestamps → dates, segmenets → segments
@github-actions
github-actions Bot requested a review from RussellSB as a code owner July 9, 2026 06:21
@github-actions
github-actions Bot requested review from ChrisMarsden833 and removed request for RussellSB July 9, 2026 06:41
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pytrendy/detect_trends.py 91.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor Author

📚 Docs preview deployed!

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

This preview will be removed when the PR is closed.

github-actions Bot added a commit that referenced this pull request Jul 11, 2026
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