Hi, Iβm new to Julia. I have some questions regarding the subset function of DataFrames. I would appreciate if you could help me to solve them.
df = DataFrame(x=[2,0,8,9], y=[0,0,0,8], z=["A", "B", "C", "D"], w=["A","A","B", "B"])
When I filter the dataframe using the || operator, I get an incorrect result. It does not filter correctly the :y column.
subset(df , [:x, :y] => ByRow((a,b)-> a !=0 || b !=0))
But when I use the | operator the filter is correct.
subset(df , [:x, :y] => ByRow((a,b)-> a !=0 | b !=0))
On the other hand, if I run the following code, I get an error because I am not using the || operator.
subset(df , [:z, :w] => ByRow((a,b)-> a =="A" | b == "A" ))
subset(df , [:z, :w] => ByRow((a,b)-> a =="A" || b == "A" ))
So my doubts are:
why in the first case the || operator gives an incorrect result when the variable is numeric. While in the second case, when the variable is a string, it gives a correct result.
I apologize if my English is not understood well.