Rows That Are Not Constant
easynumpy_indexingImplement rows_not_constant(X).
Given a 2D array X, return the sub-array of rows that are not constant
(rows whose values are not all equal), preserving their order. Use a boolean
row mask — no for/while loops.
Constraints
- no scipy, sklearn
- no for/while loops
Your solution
Edit rows_not_constant and run the real pytest suite in your browser — no install required. Your code is saved locally.
Loading the Python runtime (first run only)…
Hints
Hint 1
A row is constant iff its max equals its min — compare per-row max and min, then mask rows.