Skip to content

fix: assign sort_index() result in filter.py#2180

Open
agenthaulk wants to merge 1 commit intomicrosoft:mainfrom
agenthaulk:fix/sort-index-filter-2165
Open

fix: assign sort_index() result in filter.py#2180
agenthaulk wants to merge 1 commit intomicrosoft:mainfrom
agenthaulk:fix/sort-index-filter-2165

Conversation

@agenthaulk
Copy link
Copy Markdown

@agenthaulk agenthaulk commented Apr 1, 2026

Summary

Fixes #2165

pandas.Series.sort_index() returns a new Series and does not modify in place. The return value was discarded, causing the timestamp series to remain unsorted and potentially produce incorrect filter boundaries.

Changes

  • Assigned sort_index() result back to timestamp_series in qlib/data/filter.py (line 163)
- timestamp_series.sort_index()
+ timestamp_series = timestamp_series.sort_index()

Test Plan

  • Verified the sorted series is correctly assigned
  • Existing filter-related tests should pass
  • Manual verification: unsorted index no longer produces incorrect filter boundaries

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.

Bug: sort_index() result discarded in filter.py — timestamp series may be unsorted

1 participant