PY-62
Select Aligned Rows with One Condition
Task
Write select_aligned_rows(ids, values, column, lower, upper). ids is a
one-dimensional NumPy array. values is a two-dimensional numeric array with
the same first-axis length. column is valid and lower <= upper.
Build the boolean mask for rows whose selected-column value lies in the
inclusive interval [lower, upper]. Return (selected_ids, selected_values, mask). The two selected arrays must be independent copies; the boolean mask
must have shape (rows,). Preserve row order and do not change either input.
Example
For IDs ['a','b','c'], values [[1,9],[2,5],[3,7]], column 1, and interval
[6,9], the mask is [True,False,True] and rows a and c remain aligned.
Your implementation
You may import NumPy as np. Do not modify an input, print, or ask for input.