Trying to subset a datatable by values that don't match a list:
DT1 = dt.Frame(A = ['a', 'b', 'c', 'd'])
sel_rows = functools.reduce(operator.or_,(f.A != obs for obs in ['a', 'b']))
DT1[sel_rows, :]
However this returns all the rows,
I'd expect only the rows with only 'c' and 'd' in column A to returned.
Why is everything returned? How do I edit this to have that behavior.
Solved it by changing operator.or to operator.and...
DT1 = dt.Frame(A = ['a', 'b', 'c', 'd'])
sel_rows = functools.reduce(operator.and_,(f.A != obs for obs in ['a', 'b']))
DT1[sel_rows, :]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With