My grid search fails for some values of k.
Why this happens
You asked for more features than the data has. This often happens in a grid search, or when an earlier pipeline step (like VarianceThreshold) removes columns, so fewer reach the selector than you expected. Older scikit-learn versions raise an error. Newer versions warn and simply return all features.
Answer 1: Use k="all" or keep k within range
If you meant "use every feature", say so explicitly with k="all". Otherwise, make sure k is no larger than the number of columns that actually reach the selector.
