import numpy as np temperatures = np.array([18.5, 21.0, 26.5, 31.0, 24.0]) samples = np.array( [ [18.5, 0.91], [26.5, 0.98], [31.0, 0.99], [21.0, 0.87], ] ) hot_day_mask = temperatures >= 24 hot_days = temperatures[hot_day_mask] valid_hot_row_mask = (samples[:, 0] >= 24) & (samples[:, 1] >= 0.95) selected_rows = samples[valid_hot_row_mask] np.testing.assert_array_equal(hot_days, np.array([26.5, 31.0, 24.0])) np.testing.assert_array_equal( selected_rows, np.array([[26.5, 0.98], [31.0, 0.99]]), ) print("hot day mask:", hot_day_mask) print("hot days:", hot_days) print("valid hot row mask:", valid_hot_row_mask) print("selected rows:") print(selected_rows)