Select#
Pick one or more columns from a wide (rows, columns) value stream by position.
The index and the number of rows are unchanged; only the width changes. Usable
eagerly and inside a Pipeline.
Feeding a lazy iterator of (value, index) pairs returns a lazy iterator of column-selected events; feeding arrays or (values, index) tuples returns the batch result.
Example#
Keep column 1 of a two-column stream.
import numpy as np
from screamer import Select
wide = np.array([[10.0, 11.0],
[20.0, 21.0],
[30.0, 31.0]])
column, idx = Select(1)(wide)
print(column)
[11. 21. 31.]
Pass a list of positions (for example [0, 2]) to keep several columns in a
chosen order.