I have a DataFrame and I want to filter the rows where column During_Cabg
OR column During_Pci
have a value of 1. Here's what I'm doing:
pci_or_cabg = @chain df begin
select([:During_Cabg, :During_Pci] .=> ByRow(x -> coalesce.(x, 0)); renamecols=false)
subset(:During_Cabg => ByRow(==(1)), :During_Pci => ByRow(==(1)))
end
The problem is that this line: ByRow(==(1)), :During_Pci => ByRow(==(1)
seems to imply an AND not OR. The result I'm getting is values where BOTH columns are 1 (not what I want).
How to subset a DataFrame with multiple conditions (AND or OR) with multiple columns?
Thank you!