Try if Polars can handle k corrset problem
Primary LanguageJupyter Notebook
See here
Estimated time for k = 5 on medium = 1.5 days.