def apply_mask_column(data, index, mask):
"""
Sieve picks a mask over data and returns the filtered data array and index
"""
new_data = data[mask]
new_index = np.empty_like(index)
data_cursor = 0
for i, idx in enumerate(index):
if idx:
if mask[data_cursor]:
new_index[i] = 1
else:
new_index[i] = 0
data_cursor += 1
else:
new_index[i] = 0
return new_data, new_index
评论列表
文章目录