Skip to content
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

fix: Incorrect result for top_k/bottom_k when input is sorted #21264

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

lukemanley
Copy link
Contributor

closes #21260

import polars as pl

pl.Series([1, 2, 3, 4]).sort().top_k(3)

# BEFORE

# shape: (3,)
# Series: '' [i64]
# [
#         1
#         2
#         3
# ]

# AFTER

# shape: (3,)
# Series: '' [i64]
# [
#         2
#         3
#         4
# ]

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Feb 14, 2025
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.87%. Comparing base (9077aa4) to head (a6acde9).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21264      +/-   ##
==========================================
- Coverage   79.87%   79.87%   -0.01%     
==========================================
  Files        1596     1596              
  Lines      228469   228468       -1     
  Branches     2607     2607              
==========================================
- Hits       182487   182482       -5     
- Misses      45386    45390       +4     
  Partials      596      596              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 4ef23d8 into pola-rs:main Feb 14, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

top_k on unsorted df with descending=true has opposite order
2 participants